This repository has been archived by the owner on May 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrobotics_wheel.ino
100 lines (91 loc) · 2.44 KB
/
robotics_wheel.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#include <FastLED.h>
#define LED_PIN 35
#define NUM_LEDS 266
CRGB leds[NUM_LEDS];
int four[] = {72, 79, 110, 117, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 155, 186, 193, 224, 41, 212, 205, 174, 167};
int three[] = {41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, 214, 213, 212, 72, 79, 110, 117, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 155, 186, 193};
int two[] = {41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, 214, 213, 212, 60, 91, 98, 129, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 155, 186, 193};
const int reciever = 47;
int val;
int c = 0;
int z = 0;
/**
* Mia=
*/
void setup() {
Serial.begin(9600);
pinMode(reciever, INPUT_PULLUP);
FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CRGB(0, 0, 0);
FastLED.show();
}
}
void loop() {
val = digitalRead(reciever);
if (val == 1 && z >= 10) {
leds[c] = CRGB(0, 0, 255);
FastLED.show();
c++;
} else {
z++;
}
if (val == 1) {
z = 0;
}
if (c == NUM_LEDS) {
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CRGB(0, 0, 0);
FastLED.show();
delay(10);
}
c = 0;
delay(1000);
//4
for (int i = 0; i < 26; i++) {
leds[four[i]] = CRGB(0, 0, 255);
FastLED.show();
}
delay(500);
for (int i = 0; i < 26; i++) {
leds[four[i]] = CRGB(0, 0, 0);
FastLED.show();
}
//3
for (int i = 0; i < 46; i++) {
leds[three[i]] = CRGB(0, 0, 255);
FastLED.show();
}
delay(500);
for (int i = 0; i < 46; i++) {
leds[three[i]] = CRGB(0, 0, 0);
FastLED.show();
}
//4
for (int i = 0; i < 26; i++) {
leds[four[i]] = CRGB(0, 0, 255);
FastLED.show();
}
delay(500);
for (int i = 0; i < 26; i++) {
leds[four[i]] = CRGB(0, 0, 0);
FastLED.show();
}
//2
for (int i = 0; i < 46; i++) {
leds[two[i]] = CRGB(0, 0, 255);
FastLED.show();
}
delay(500);
for (int i = 0; i < 46; i++) {
leds[two[i]] = CRGB(0, 0, 0);
FastLED.show();
}
/*
while (true) {
leds[(int) random(265)] = CRGB(0, 0, (int) random(255));
FastLED.show();
}
*/
}
}