Lab 1

Page Modified on: 05/07/04

Lab 1
Lab 3
Fire Fighter Project
Knight Rider Project
MCP Project
Egghunt project
Photo Gallery


Robot Design

Prof: Fred Martin

Student: Aron Barabas


Lab 1

The Handy Cricket

Due Feb 05 2004



1, Playing with the cricket.

Experiment with the Handy Cricket and the Cricket Logo software. Play with motor and sensor commands. Display sensor data back on the the Cricket Logo screen.


The cricket has two motor outputs and can control up to 4 motors. Two motors on each output channel. We can adjust the power levels from 0-8 with setpower.

We can address the motor channels individually by selecting a, ab or b.

Send will send a value back through the serial port that will print out on the Cricket Logo Screen.


The following code will turn motor a on and will print out random numbers from 0-100 on the Cricket Logo screen:


to demo

a, on

send random % 100




2 Experiment with the Cricket's IR communications primitives send, newir?, and ir. Get one Cricket to trigger another Cricket to do something.

3 Create a multi-Cricket application whereby the Crickets pass a software token from one to another (“multi” >= 2). When a Cricket has the token, it should display some behavior to make this evident (e.g., beeping or turning on a motor output). Then this Cricket should be able to pass the token to another Cricket. Are there any problems in accomplishing this? Are the problems of a fundamental nature, or just implementation details?


 I have already played with send newir? and ir

to sender
  send random % 3
  wait 30


to doit
  waituntil [newir?]
  if ir = 0 [a, onfor 10]
  if ir = 1 [b, onfor 10]
  if ir = 2 [ab, onfor 10]



To execute the previous code we need two crickets. One the sender will transmit random numbers 0, 1 or 2. The other cricket will have the doit code on it and it will receive a number through the ir port and will analyze it. If the number is 0 port a will be turned on for 10 time units.

If the number is 2, motor port b will be turned on. If the received number is 3 both ports will be turned on.


4, Devise an experiment to determine if Cricket Logo arrays use 0 or 1 as an index for the first array element. (The Cricket Logo documentation does not specify.)

I used the following code to test if the arrays use 0 or 1 as the index for the first element.


array [test 1]

to arrays

aset test 0 4

aset test 1 5

aset test 2 6

wait 10

send eb test

wait 10



my test shows that the arrays use 0 as the index for the first element.


5, Put a program on the Cricket that continually transmits sensor values (e.g., loop [send sensora]). Write a program that runs on a conventional desktop/laptop computer or a PDA that reads these values off the serial port* and displays them in some visual fashion (e.g., the music visualizations made by your desktop MP3 player).

Being a weekend disk jockey I heard that there is a plugin for Winamp that uses the serial port to interface and control Winamp.

 I actually used switches that returned a number from the cricket. The values were: 00, 01, 10, 11 because two switches were used. The numbers converted to decimal are 0, 1, 2, 3.

This mini remote is a four function remote. After a long search I found a plugin for winamp that  received values from the serial port. I cold make winamp play, stop, go to next track and previous track.