sparki.accelX();
sparki.accelY();
sparki.accelZ();
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Sparki.h> | |
void setup(){ | |
} | |
void loop(){ | |
Serial.print("x: "); | |
Serial.print(sparki.accelX()); | |
Serial.print(","); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define NOTE_B0 31 | |
#define NOTE_C1 33 | |
#define NOTE_CS1 35 | |
#define NOTE_D1 37 | |
#define NOTE_DS1 39 | |
#define NOTE_E1 41 | |
#define NOTE_F1 44 | |
#define NOTE_FS1 46 | |
#define NOTE_G1 49 | |
#define NOTE_GS1 52 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Sparki.h> | |
class RectangleWaveAnimation{ | |
int hNumRect; | |
int length; | |
int width; | |
int space; | |
int diffHeight; | |
int yCenter; | |
int xCenter; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Sparki.h> | |
int i; | |
int j; | |
int x; | |
int y; | |
int d; | |
void setup(){ | |
j=0; | |
x=100; | |
y=10; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sol(A): | |
# diff = |minuend - subtrahend| or d = |m - s| | |
# A = [3, 1, 2, 4, 3] | |
l = len(A) # l = 5 | |
m = [A[0]] # m = [3] | |
s = [A[l-1]] # s = [3] | |
s_r = [0] #reversed s | |
for p in range(1, l): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void servoNodsNo(int xTimes, int d){ | |
for (int x = 0; x < xTimes; x++){ | |
sparki.servo(-90); | |
delay(d); | |
sparki.servo(90); | |
delay(d); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void hourglassHelper(int x1, int x2, int w){ | |
sparki.moveForward(x1); | |
sparki.moveLeft(90); | |
sparki.moveForward(w); | |
sparki.moveLeft(90); | |
sparki.moveForward(x2); | |
sparki.moveRight(90); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void stopSignal(){ | |
for (int x = 1; x < 10; x++){ | |
sparki.beep(); | |
sparki.RGB(50, 0, 100); | |
delay(200); | |
} | |
sparki.RGB(RGB_OFF); | |
} | |
void stopMotors(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void checkIR() { | |
code = sparki.readIR(); | |
previousIR == code ? code = -1: 0; | |
if(code != -1) { | |
sparki.print("Received code: "); | |
sparki.updateLCD(); | |
previousIR = code; |