Terrapin Resources

Finch Commands

This section is just a quick hack. The commands will change in the future!

Commands

FINCH? (FINCHP)

Reports TRUE if a Finch is detected.

Syntax

Description

FINCH? reports TRUE if a Finch is detected.

Example

FINCH? Result: TRUE

FINCH.BUZZ

Controls the Finch’s buzzer.

Syntax

Description

FINCH.BUZZ sounds the Finch’s buzzer. Its first input is the frequency in Hertz, and its second input is the duration in milliseconds. If the duration is omitted, the sound goes on forever until (FINCH.BUZZ) is issues, which turns off the sound.

Example

; Sound the middle A note for a second FINCH.BUZZ 440 1000

FINCH.CLOSE

Closes the connection to the Finch.

Syntax

Description

FINCH.CLOSE closes the connection to the Finch.

Example

FINCH.CLOSE

FINCH.LED

Controls the Finch’s nose LED.

Syntax

Description

FINCH.LED turns the Finch’s nose LED on and sets its color to the given value. It turns off the LED after the number of milliseconds supplied as its second input expired. If the duration is omitted, the LED stays on. If FINCH.LED is used without inputs, the Finch’s nose LED is turned off.

Example

; Set the LED to red for a second FINCH.LED “RED 1000 ; Set it to blue and leave it on (FINCH.LED “BLUE) ; turn it off (FINCH.LED)

FINCH.MOTORS

Controls the Finch’s motors.

Syntax

Description

FINCH.MOTORS controls the Finch’s motors. The first two inputs control the speed and direction o the left and right wheels. Possible values are -1 (full power backwards) to 1 (full power forward). A value of 0 (which Logo assumes if a value if not supplied) turns the motor off.FINCH.MOTORS turns off the motors after the number of milliseconds supplied as its third input expired. If the duration is omitted, the motors stay on. If FINCH.MOTORS is used without inputs, the Finch’s motors are turned off.

Example

; Move back at half speed for a second FINCH.MOTORS -0.5 -0.5 1000 ; turn the Finch right for half a second FINCH.MOTORS 0.5 -0.5 500

FINCH.SENSORS

Reports the value of Finch’s sensor array.

Syntax

Description

FINCH.SENSORS reports the values of Finch’s sensor array as a four element list. The first value is a three-element list containing the values of Finch’s accelerometers (X, Y and Z, values between -1 and 1). The second element is a two-element list of Finch’s left and right lisght sensors (a value between 0 and 1). The third element is a two-element list containing the value of the left and right obstacle sensors (either TRUE or FALSE), and the last element is the temperatore sensor in degrees Celsius.

Example

FINCH.SENSORS Result: [[0.05 -0.05 1.08] [0.37 0.52] [FALSE FALSE] 22.08]