Skip to content

Instantly share code, notes, and snippets.

@mithi
Last active November 19, 2015 16:51
Show Gist options
  • Save mithi/72e72d188f9f50158b69 to your computer and use it in GitHub Desktop.
Save mithi/72e72d188f9f50158b69 to your computer and use it in GitHub Desktop.
Sparki Cheat Sheet

SPARKI CHEAT SHEET

Accelerometer

sparki.accelX();
sparki.accelY();
sparki.accelZ();

Bluetooth Module

Serial1.read();
Serial1.print();
Serial1.println();

Buzzer

sparki.beep();
sparki.beep(int freq);
sparki.beep(int freq, int time);

Gripper

sparki.gripperOpen();
sparki.gripperOpen(width_cm);
sparki.gripperClose();
sparki.gripperClose(width_cm);
sparki.gripperStop();

Infrared LED

sparki.sendIR();

Infrared Reflectance Sensor

sparki.edgeLeft();
sparki.lineLeft();
sparki.lineCenter();
sparki.lineRight();
sparki.edgeRight();

Infrared Remote Receiver

sparki.readIR();

LCD

sparki.clearLCD();
sparki.updateLCD();

sparki.drawPixel(xPixel, yPixel);
sparki.readPixel(xPixel, yPixel);
sparki.drawChar(xPixel, yLine, char);
sparki.drawString(xPixel, yLine, *char);
sparki.drawLine(xStart, yStart, xEnd, yEnd);
sparki.drawRect(xCorner, yCorner, width, height);
sparki.drawRectFilled(xCorner, yCorner, width, height);
sparki.drawCircle(xCenter, yCenter, radius);
sparki.drawCircleFilled(xCenter, yCenter, radius);
sparki.drawBitmap(xStart, yStart, *bitmap, width, height);

Light Sensor

sparki.lightLeft();
sparki.lightCenter();
sparki.lightRight();

Magnetometer

sparki.magX();
sparki.magY();
sparki.magZ();

RGB LED

sparki.RGB(R, G, B);

Status LED

digitalWrite(STATUS_LED, HIGH);
digitalWrite(STATUS_LED, LOW);
analogWrite(STATUS_LED, 0);
analogWrite(STATUS_LED, 123);
analogWrite(STATUS_LED, 255);

Wheels

sparki.moveForward(distance_cm);
sparki.moveBackward(distance_cm);
sparki.moveLeft(angle_degrees);
sparki.moveRight(angle_degrees);
sparki.moveStop();

Servo

sparki.servo(angle_degrees);

Stepper Motors

sparki.motorRotate(int motor, int direction, int speed);
sparki.motorStop(int motor);

Ultrasonic Range Finder

sparki.ping();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment