Skip to content

Instantly share code, notes, and snippets.

@mithi
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mithi/d8c14b120bd3cda32288 to your computer and use it in GitHub Desktop.
Save mithi/d8c14b120bd3cda32288 to your computer and use it in GitHub Desktop.
testing bluetooth with sparki
#include <Sparki.h>
void setup(){
Serial1.begin(9600);
}
void loop(){
Serial1.print("Distance = ");
Serial1.print(sparki.ping());
Serial1.println(" cm");
delay(300);
if (Serial1.available()){
int inByte = Serial1.read();
Serial1.print((char)inByte);
switch((char)inByte){
case '1': sparki.servo(SERVO_RIGHT); sparki.RGB(RGB_BLUE); break;
case '2': sparki.servo(SERVO_CENTER); sparki.RGB(RGB_GREEN); break;
case '3': sparki.servo(SERVO_LEFT); sparki.RGB(RGB_RED); break;
default: break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment