Skip to content

Instantly share code, notes, and snippets.

@mithi
Created July 9, 2015 10:02
Show Gist options
  • Save mithi/50cc85e3224187372802 to your computer and use it in GitHub Desktop.
Save mithi/50cc85e3224187372802 to your computer and use it in GitHub Desktop.
serial test with Sparki by arcbotics
#include <Sparki.h>
void setup(){
}
void loop(){
Serial.print("Distance = ");
Serial.print(sparki.ping());
Serial.println(" cm");
delay(300);
if (Serial.available()){
int inByte = Serial.read();
Serial.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;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment