Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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