Last active
October 21, 2018 04:08
-
-
Save dimitarminchev/2bc58ef144fe02a6962a43d59b1285c6 to your computer and use it in GitHub Desktop.
NASA2018 MicroBit Device
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
"THE A TEAM" proudly presents the project "ROV4KIDS" from the challenge "INVENT YOUR OWN CHALLENGE" | |
NASA Space Apps Challenge 2018, Burgas Free University, Bulgaria | |
*/ | |
// Micro:Bit On Start | |
radio.setGroup(1) | |
basic.showIcon(IconNames.No) | |
pins.servoSetPulse(AnalogPin.P0, 0) | |
pins.servoSetPulse(AnalogPin.P1, 0) | |
// Event Hadler for Received Commands | |
radio.onDataPacketReceived(({ receivedNumber: COMMAND }) => { | |
if (COMMAND == 0) { | |
basic.showIcon(IconNames.No) | |
pins.servoSetPulse(AnalogPin.P0, 0) | |
pins.servoSetPulse(AnalogPin.P1, 0) | |
} | |
if (COMMAND == 1) { | |
basic.showArrow(ArrowNames.West) | |
pins.servoSetPulse(AnalogPin.P0, 200000) | |
pins.servoSetPulse(AnalogPin.P1, 0) | |
} | |
if (COMMAND == 2) { | |
basic.showArrow(ArrowNames.East) | |
pins.servoSetPulse(AnalogPin.P0, 0) | |
pins.servoSetPulse(AnalogPin.P1, 200000) | |
} | |
if (COMMAND == 3) { | |
basic.showArrow(ArrowNames.North) | |
pins.servoSetPulse(AnalogPin.P0, 200000) | |
pins.servoSetPulse(AnalogPin.P1, 200000) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
"THE A TEAM" proudly presents the project "ROV4KIDS" from the challenge "INVENT YOUR OWN CHALLENGE"
NASA Space Apps Challenge 2018, Burgas Free University, Bulgaria