Skip to content

Instantly share code, notes, and snippets.

@deadprogram
Created January 12, 2010 05:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save deadprogram/274950 to your computer and use it in GitHub Desktop.
Save deadprogram/274950 to your computer and use it in GitHub Desktop.
P1 -> propeller(:motor)
P2 -> led
P3, P4 <-> xbee(:serial)
P6 <- button(:button)
P7 <- thermometer(:analog)
every 100ms do
if button.pushed
led.off
end
if thermometer.read > 100
xbee.send "It is very hot!"
led.on
end
end
every 500ms do
xbee.receive_commands
if command1 == 'lights'
led.on
end
if command1 == 'action'
if direction == :forward
direction = :back
else
direction = :forward
end
propeller.turn(direction, 50)
end
if command1 == 'camera'
xbee.send "I have no camera"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment