Skip to content

Instantly share code, notes, and snippets.

@mithi
Last active August 29, 2015 14:26
Show Gist options
  • Save mithi/819c49ff6a6f58438e98 to your computer and use it in GitHub Desktop.
Save mithi/819c49ff6a6f58438e98 to your computer and use it in GitHub Desktop.
snippet of IR test
void checkIR() {
code = sparki.readIR();
previousIR == code ? code = -1: 0;
if(code != -1) {
sparki.print("Received code: ");
sparki.updateLCD();
previousIR = code;
}
}
void loop() {
printNotBusy();
checkIR();
switch(code) {
case 70: sparki.moveForward(); break;
case 21: sparki.moveBackward(); break;
case 67: sparki.servo(SERVO_RIGHT); sparki.RGB(RGB_BLUE); break;
case 71: sparki.moveRight(); break;
case 69: sparki.moveLeft(); break;
case 68: sparki.servo(SERVO_LEFT); sparki.RGB(RGB_RED); break;
case 64: sparki.servo(SERVO_CENTER); sparki.RGB(RGB_GREEN); break;
case 9: sparki.gripperOpen(); break;
case 7: sparki.gripperClose(); break;
case 22: printBusy(); pattern.crazySun(60, 100, 8000, 128000); break;
case 25: printBusy(); pattern.squigglyLines(5, 100, 8000, 2); break;
case 13: printBusy(); pattern.circle(5, 100, 8000, 24000); break;
case 12: printBusy(); pattern.hourglass(20,1); break;
case 24: printBusy(); pattern.maze(10,1); break;
case 94: printBusy(); pattern.spiral(50); break;
case 8: printBusy(); pattern.abstractL(5, 2, 4); break;
case 28: printBusy(); pattern.veeness(8, 2, 7, 30); break;
case 90: printBusy(); RGBRainbow(); break;
case 66: printBusy(); writeM(1); break;
case 82: printBusy(); writeM(2); break;
case 74: printBusy(); writeM(3); break;
default: break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment