-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharc497.particlePhoton.basics
67 lines (44 loc) · 1.13 KB
/
arc497.particlePhoton.basics
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
int WildRed =0;
int WildBlue = 0;
int WildGreen = 0;
int WildBright = 0;
int LED = D0;
bool state = false;
int AnVal = 0;
void setup() {
RGB.control(true);
pinMode(7, OUTPUT);
pinMode(0, OUTPUT);
digitalWrite(LED, HIGH);
//Particle.variable("Analog Value", AnVal);
/*HIGH, 1, and true are equivalent values for the high-voltage digital state.
LOW, 0, and false are the low-voltage digital state.*/
Particle.function("TOGGLE", toggle);
}
void loop() {
WildRed = random(0,255);
WildBlue = random(0,255);
WildGreen = random(0,255);
WildBright = random(0,255);
RGB.color(WildRed, WildGreen, WildBlue);
RGB.brightness(WildBright);
delay(50);
digitalWrite(7, HIGH);
delay(100);
digitalWrite(7, LOW);
delay(1000);
AnVal = analogRead(0);
for(int i = 0; i<255; i++){
RGB.color(0, 0, i);
delay(5);
RGB.color(i,0,0);
delay(5);
}
delay(1000);
Particle.publish("MESSAGE", "HELLO");
Particle.publish("Analog Value", AnVal);
}
int toggle(String args){
int t = args.toInt();
digitalWrite(LED, t);
}