Skip to content

Instantly share code, notes, and snippets.

@dimitarminchev
Last active October 21, 2018 04:08
Show Gist options
  • Save dimitarminchev/2bc58ef144fe02a6962a43d59b1285c6 to your computer and use it in GitHub Desktop.
Save dimitarminchev/2bc58ef144fe02a6962a43d59b1285c6 to your computer and use it in GitHub Desktop.
NASA2018 MicroBit Device
/*
"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)
}
})
@dimitarminchev
Copy link
Author

"THE A TEAM" proudly presents the project "ROV4KIDS" from the challenge "INVENT YOUR OWN CHALLENGE"
NASA Space Apps Challenge 2018, Burgas Free University, Bulgaria

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment