Skip to content

Instantly share code, notes, and snippets.

@cefn
Last active May 30, 2016 18:07
Show Gist options
  • Select an option

  • Save cefn/fa61f394dcdb3f991de6ba3d821c3736 to your computer and use it in GitHub Desktop.

Select an option

Save cefn/fa61f394dcdb3f991de6ba3d821c3736 to your computer and use it in GitHub Desktop.
#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