-
Notifications
You must be signed in to change notification settings - Fork 0
/
pwms.ino
executable file
·255 lines (187 loc) · 4.92 KB
/
pwms.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
// pwms.ino
/*
_ __
/ \ (_ |\/| _ _ _| _ _
\/\/ \/\/ \/\/ o \_/ __) | | o (_ (_) (_| (/_ _>
*/
void BLINKPWM(byte red, byte green, byte blue, int time,byte BlinkTimes)
{ // void osmPWM
while (BlinkTimes > 0 && ToBorNotToB)
{ // while time
osmPWM(red,green,blue,time);
osmPWM(0,0,0,time);
BlinkTimes--;
}// elihw time
}// diov osmPWM
void BLINK(byte red, byte green, byte blue, int time,int BlinkTimes)
{ // void osmPWM
//time = time * 14;
while (BlinkTimes > 0 && ToBorNotToB)
{ // while time
osmPWM(red,green,blue,time);
osmPWM(0,0,0,time);
BlinkTimes--;
}// elihw time
}// diov osmPWM
// this is the light engine
void osmPWM(byte red, byte green, byte blue, int time)
{ // void osmPWM
time = time * 14;
while (time > 0 && ToBorNotToB)
{ // while time
analogWrite(5, blue); // blue
analogWrite(6, green); // green
analogWrite(9, red); // red
time--;
}// elihw time
}// diov osmPWM
// this is the light engine
void osmPWMtimeless(byte red, byte green, byte blue)
{ // void osmPWMtimeless
analogWrite(5, blue); // blue
analogWrite(6, green); // green
analogWrite(9, red); // red
}// diov osmPWMtimeless
// THIS ROUTINE WILL TURN OFF THE LIGHT
void AnalogBlank(void)
{ // void blankPWM
analogWrite(5, 0);
analogWrite(6, 0);
analogWrite(9, 0);
}// diov blankPWM
// this is the light engine
void osmPWMSCC(byte red, byte green, byte blue, byte shade, int time)
{ // void osmPWM
time = time * 14;
while (time > 0 && ToBorNotToB)
{ // while time
analogWrite(5, blue); // blue
analogWrite(6, green); // green
analogWrite(9, red); // red
if (shade>0)
{// if shade > 0
ShaderFactor = 4;
while (ShaderFactor>0 && ToBorNotToB)
{// while shader 1
AnalogBlank();
ShaderFactor--;
time--;
}// elihw shader 1
if (shade>1)
{// if shade >1
ShaderFactor = 4;
while (ShaderFactor>0 && ToBorNotToB)
{// while shader 2
AnalogBlank();
ShaderFactor--;
time--;
}// elihw shader 2
if (shade>2)
{// if shade >2
ShaderFactor = 6;
while (ShaderFactor>0 && ToBorNotToB)
{// while shader 2
AnalogBlank();
ShaderFactor--;
time--;
}// elihw shader 2
}// fi shade >2
}// fi shade >1
}// fi shade > 0
time--;
}// elihw time
}// diov osmPWM
// this is the light engine
void osmPWMSCCxyz(byte red, byte green, byte blue, byte shade, int time)
{ // void osmPWM
TTtime = time * 14;
while ((TTtime > 0) && (ToBorNotToB) && (Armed) )
{ // while time
analogWrite(5, blue); // blue
analogWrite(6, green); // green
analogWrite(9, red); // red
mmaSensor(PMMAselect, PmmAxis, PAccelCounterDebouncer, PAccelSensitivity);
AnalogBlank();// added
if (shade>0)
{// if shade > 0
ShaderFactor = 4;
while (ShaderFactor>0 && ToBorNotToB)
{// while shader 1
AnalogBlank();
ShaderFactor--;
TTtime--;
}// elihw shader 1
if (shade>1)
{// if shade >1
ShaderFactor = 4;
while (ShaderFactor>0 && ToBorNotToB)
{// while shader 2
AnalogBlank();
ShaderFactor--;
TTtime--;
}// elihw shader 2
if (shade>2)
{// if shade >2
ShaderFactor = 6;
while (ShaderFactor>0 && ToBorNotToB)
{// while shader 2
AnalogBlank();
ShaderFactor--;
TTtime--;
}// elihw shader 2
}// fi shade >2
}// fi shade >1
}// fi shade > 0
TTtime--;
}// elihw time
}// diov osmPWM
// this is the light engine
void osmPWM_Plane(byte red, byte green, byte blue, int time)
{ // void osmPWM
time = time * 14;
while (time > 0)
{ // while time
analogWrite(5, blue); // blue
analogWrite(6, green); // green
analogWrite(9, red); // red
time--;
}// elihw time
}// diov osmPWM
void osmPWMCC(byte CColorN, int Ctime)
{// void osmPWMCC
osmPWM(CCR[VARIATION][CColorN], CCG[VARIATION][CColorN], CCB[VARIATION][CColorN], Ctime);
}// diov osmPWMCC
//// this is the light engine
//void osmPWM_SuperPlane(byte red, byte green, byte blue, int time)
//{ // void osmPWM
////time = time * 14;
//while (time > 0)
//{ // while time
//analogWrite(5, blue); // blue
//analogWrite(6, green); // green
//analogWrite(9, red); // red
//time--;
//}// elihw time
//}// diov osmPWM
// BLINKY FLASH A BOOLEAN OF RED, GREEN, BLUE (1 = ON, 0 = OFF)
void Blinky_ForInterrupt(boolean reddy, boolean greeny, boolean bluey, int delayly)
{
while (delayly > 0)
{
digitalWrite(9, reddy); // 9 RED
digitalWrite(6, greeny); // 6 GREEN
digitalWrite(5, bluey); // 5 BLUE
for (int vv = 180; vv > 0; vv--)
{
NOP;
}
delayly--;
}
}
// BLINKY FLASH A BOOLEAN OF RED, GREEN, BLUE (1 = ON, 0 = OFF)
void BlinkyInterrupt(boolean reddy, boolean greeny, boolean bluey)
{
digitalWrite(9, reddy); // 9 RED
digitalWrite(6, greeny); // 6 GREEN
digitalWrite(5, bluey); // 5 BLUE
}