Created
February 2, 2023 10:33
-
-
Save MrSmoke/3a35135ad56e2c30053dfe2fd2e70c1d to your computer and use it in GitHub Desktop.
Pant code
This file contains 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 WAIST 2 | |
#define LEFT_LEG 3 | |
#define RIGHT_LEG 4 | |
#define LEFT_SHOE 5 | |
#define RIGHT_SHOE 6 | |
#define W WAIST | |
#define LL LEFT_LEG | |
#define RL RIGHT_LEG | |
#define LS LEFT_SHOE | |
#define RS RIGHT_SHOE | |
#define DELAY_TIME 500 | |
#define FAST_DELAY_TIME 200 | |
void setup() { | |
// put your setup code here, to run once: | |
pinMode(WAIST, OUTPUT); | |
pinMode(LEFT_LEG, OUTPUT); | |
pinMode(RIGHT_LEG, OUTPUT); | |
pinMode(LEFT_SHOE, OUTPUT); | |
pinMode(RIGHT_SHOE, OUTPUT); | |
} | |
void loop() { | |
// i wish i knew how to use c++ lambdas | |
// 1 | |
scene_1(); d(); | |
scene_1(); d(); | |
scene_1(); d(); | |
// 2 | |
scene_2(); d(); | |
scene_2(); d(); | |
scene_2(); d(); | |
// 3 | |
scene_3(); d(); | |
scene_3(); d(); | |
scene_3(); d(); | |
// 4 | |
scene_4(); d(); | |
scene_4(); d(); | |
scene_4(); d(); | |
// 5 | |
scene_5(); d(); | |
scene_5(); d(); | |
scene_5(); d(); | |
} | |
// wasit, legs, shoes | |
void scene_1() | |
{ | |
allOff(); | |
on(W); | |
d(); | |
on(LL); | |
on(RL); | |
d(); | |
on(LS); | |
on(RS); | |
} | |
// circle chase | |
void scene_2() | |
{ | |
allOff(); | |
on(W); | |
fast_d(); | |
on(LL); | |
fast_d(); | |
on(LS); | |
fast_d(); | |
on(RS); | |
fast_d(); | |
on(RL); | |
} | |
// blink | |
void scene_3() | |
{ | |
allOff(); | |
d(); | |
allOn(); | |
} | |
// leff then right | |
void scene_4() | |
{ | |
allOff(); | |
on(LS); | |
on(LL); | |
d(); | |
allOff(); | |
on(RS); | |
on(RL); | |
} | |
// waist then shoes | |
void scene_5() | |
{ | |
allOff(); | |
on(W); | |
d(); | |
allOff(); | |
on(LS); | |
on(RS); | |
} | |
// Lazy Mode | |
void on(int pin) | |
{ | |
digitalWrite(pin, HIGH); | |
} | |
void off(int pin) | |
{ | |
digitalWrite(pin, LOW); | |
} | |
void allOff() | |
{ | |
off(WAIST); | |
off(LEFT_LEG); | |
off(RIGHT_LEG); | |
off(LEFT_SHOE); | |
off(RIGHT_SHOE); | |
} | |
void allOn() | |
{ | |
on(WAIST); | |
on(LEFT_LEG); | |
on(RIGHT_LEG); | |
on(LEFT_SHOE); | |
on(RIGHT_SHOE); | |
} | |
// Delay | |
void d() | |
{ | |
delay(DELAY_TIME); | |
} | |
// Fast delay | |
void fast_d() | |
{ | |
delay(FAST_DELAY_TIME); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment