Last active
May 30, 2016 18:07
-
-
Save cefn/fa61f394dcdb3f991de6ba3d821c3736 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #include "MicroBit.h" | |
| #include "MicroBitDisplay.h" | |
| MicroBitSerial serial(MICROBIT_PIN_P14, MICROBIT_PIN_P15); | |
| MicroBitDisplay display; | |
| const char commandbytes[] = {0xFF, 0x01, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79}; | |
| ManagedString command(commandbytes, 9); | |
| //ManagedString((((uint16_t)highppm) * 256) + lowppm) | |
| int main() | |
| { | |
| serial.baud(9600); | |
| while(1){ | |
| serial.send(command); | |
| ManagedString response = serial.read(9); | |
| char header = response.charAt(1); | |
| char highppm = response.charAt(2); | |
| char lowppm = response.charAt(3); | |
| if(header == 0x86){ | |
| display.scroll(ManagedString("D")); | |
| } | |
| else{ | |
| display.scroll(ManagedString("?")); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment