Skip to content

Commit 7295637

Browse files
committed
node red
1 parent d355ede commit 7295637

File tree

15 files changed

+876
-0
lines changed

15 files changed

+876
-0
lines changed
38.8 KB
Binary file not shown.
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
[
2+
{
3+
"id": "e5f34640c8d785bc",
4+
"type": "tab",
5+
"label": "Flow 2",
6+
"disabled": false,
7+
"info": "",
8+
"env": []
9+
},
10+
{
11+
"id": "f19902682fb20b77",
12+
"type": "ui_button",
13+
"z": "e5f34640c8d785bc",
14+
"name": "",
15+
"group": "a4bbf960c29059da",
16+
"order": 1,
17+
"width": 0,
18+
"height": 0,
19+
"passthru": false,
20+
"label": "ON",
21+
"tooltip": "",
22+
"color": "",
23+
"bgcolor": "",
24+
"className": "",
25+
"icon": "",
26+
"payload": "a",
27+
"payloadType": "str",
28+
"topic": "topic",
29+
"topicType": "msg",
30+
"x": 250,
31+
"y": 180,
32+
"wires": [
33+
[
34+
"088d4eac0ec54181"
35+
]
36+
]
37+
},
38+
{
39+
"id": "970b524e0324978b",
40+
"type": "ui_switch",
41+
"z": "e5f34640c8d785bc",
42+
"name": "",
43+
"label": "switch",
44+
"tooltip": "",
45+
"group": "a4bbf960c29059da",
46+
"order": 3,
47+
"width": 0,
48+
"height": 0,
49+
"passthru": true,
50+
"decouple": "false",
51+
"topic": "topic",
52+
"topicType": "msg",
53+
"style": "",
54+
"onvalue": "a",
55+
"onvalueType": "str",
56+
"onicon": "",
57+
"oncolor": "",
58+
"offvalue": "s",
59+
"offvalueType": "str",
60+
"officon": "",
61+
"offcolor": "",
62+
"animate": false,
63+
"className": "",
64+
"x": 250,
65+
"y": 320,
66+
"wires": [
67+
[
68+
"088d4eac0ec54181"
69+
]
70+
]
71+
},
72+
{
73+
"id": "1156e6474b31b145",
74+
"type": "ui_button",
75+
"z": "e5f34640c8d785bc",
76+
"name": "",
77+
"group": "a4bbf960c29059da",
78+
"order": 2,
79+
"width": 0,
80+
"height": 0,
81+
"passthru": false,
82+
"label": "OFF",
83+
"tooltip": "",
84+
"color": "",
85+
"bgcolor": "",
86+
"className": "",
87+
"icon": "",
88+
"payload": "s",
89+
"payloadType": "str",
90+
"topic": "topic",
91+
"topicType": "msg",
92+
"x": 250,
93+
"y": 240,
94+
"wires": [
95+
[
96+
"088d4eac0ec54181"
97+
]
98+
]
99+
},
100+
{
101+
"id": "088d4eac0ec54181",
102+
"type": "serial out",
103+
"z": "e5f34640c8d785bc",
104+
"name": "",
105+
"serial": "a15e3866dfed3f77",
106+
"x": 540,
107+
"y": 240,
108+
"wires": []
109+
},
110+
{
111+
"id": "a4bbf960c29059da",
112+
"type": "ui_group",
113+
"name": "Default",
114+
"tab": "49dbc69617c4d1f0",
115+
"order": 1,
116+
"disp": true,
117+
"width": 6,
118+
"collapse": false,
119+
"className": ""
120+
},
121+
{
122+
"id": "a15e3866dfed3f77",
123+
"type": "serial-port",
124+
"name": "arduino",
125+
"serialport": "COM4",
126+
"serialbaud": "9600",
127+
"databits": 8,
128+
"parity": "none",
129+
"stopbits": 1,
130+
"waitfor": "",
131+
"dtr": "none",
132+
"rts": "none",
133+
"cts": "none",
134+
"dsr": "none",
135+
"newline": "\\n",
136+
"bin": "false",
137+
"out": "char",
138+
"addchar": "",
139+
"responsetimeout": 10000
140+
},
141+
{
142+
"id": "49dbc69617c4d1f0",
143+
"type": "ui_tab",
144+
"name": "Home",
145+
"icon": "dashboard",
146+
"disabled": false,
147+
"hidden": false
148+
}
149+
]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
void setup() {
2+
Serial.begin(9600);
3+
pinMode(10, OUTPUT);
4+
}
5+
6+
void loop() {
7+
if (Serial.available() > 0) {
8+
char cmd = Serial.read();
9+
if (cmd == 'a') {
10+
digitalWrite(10, HIGH);
11+
} else if (cmd == 's') {
12+
digitalWrite(10, LOW);
13+
}
14+
}
15+
}
41.6 KB
Binary file not shown.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
void setup() {
2+
Serial.begin(9600);
3+
pinMode(2, INPUT);
4+
pinMode(13, OUTPUT);
5+
}
6+
7+
void loop() {
8+
if (digitalRead(2)) {
9+
Serial.println(1);
10+
digitalWrite(13, HIGH);
11+
} else {
12+
Serial.println(0);
13+
digitalWrite(13, LOW);
14+
}
15+
delay(100);
16+
}
Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
[
2+
{
3+
"id": "e5f34640c8d785bc",
4+
"type": "tab",
5+
"label": "Flow 2",
6+
"disabled": false,
7+
"info": "",
8+
"env": []
9+
},
10+
{
11+
"id": "1c127086dce51d54",
12+
"type": "serial in",
13+
"z": "e5f34640c8d785bc",
14+
"name": "",
15+
"serial": "a6208c41dc75af25",
16+
"x": 130,
17+
"y": 240,
18+
"wires": [
19+
[
20+
"a04ba0317981a456"
21+
]
22+
]
23+
},
24+
{
25+
"id": "c391139336c95d0a",
26+
"type": "ui_gauge",
27+
"z": "e5f34640c8d785bc",
28+
"name": "",
29+
"group": "992f56c535718c90",
30+
"order": 0,
31+
"width": 0,
32+
"height": 0,
33+
"gtype": "gage",
34+
"title": "gauge",
35+
"label": "units",
36+
"format": "{{value}}",
37+
"min": 0,
38+
"max": "1",
39+
"colors": [
40+
"#00b500",
41+
"#e6e600",
42+
"#ca3838"
43+
],
44+
"seg1": "",
45+
"seg2": "",
46+
"diff": false,
47+
"className": "",
48+
"x": 530,
49+
"y": 360,
50+
"wires": []
51+
},
52+
{
53+
"id": "265dad1b49bf62e0",
54+
"type": "debug",
55+
"z": "e5f34640c8d785bc",
56+
"name": "debug 1",
57+
"active": true,
58+
"tosidebar": true,
59+
"console": false,
60+
"tostatus": false,
61+
"complete": "false",
62+
"statusVal": "",
63+
"statusType": "auto",
64+
"x": 540,
65+
"y": 240,
66+
"wires": []
67+
},
68+
{
69+
"id": "a04ba0317981a456",
70+
"type": "delay",
71+
"z": "e5f34640c8d785bc",
72+
"name": "",
73+
"pauseType": "rate",
74+
"timeout": "5",
75+
"timeoutUnits": "seconds",
76+
"rate": "1",
77+
"nbRateUnits": "1",
78+
"rateUnits": "second",
79+
"randomFirst": "1",
80+
"randomLast": "5",
81+
"randomUnits": "seconds",
82+
"drop": true,
83+
"allowrate": false,
84+
"outputs": 1,
85+
"x": 310,
86+
"y": 240,
87+
"wires": [
88+
[
89+
"3efd139157dd6c9d"
90+
]
91+
]
92+
},
93+
{
94+
"id": "3efd139157dd6c9d",
95+
"type": "change",
96+
"z": "e5f34640c8d785bc",
97+
"name": "",
98+
"rules": [
99+
{
100+
"t": "set",
101+
"p": "payload",
102+
"pt": "msg",
103+
"to": "$trim(msg.payload)\t",
104+
"tot": "jsonata"
105+
}
106+
],
107+
"action": "",
108+
"property": "",
109+
"from": "",
110+
"to": "",
111+
"reg": false,
112+
"x": 240,
113+
"y": 340,
114+
"wires": [
115+
[
116+
"abf8c0200b099a52"
117+
]
118+
]
119+
},
120+
{
121+
"id": "abf8c0200b099a52",
122+
"type": "change",
123+
"z": "e5f34640c8d785bc",
124+
"name": "",
125+
"rules": [
126+
{
127+
"t": "set",
128+
"p": "payload",
129+
"pt": "msg",
130+
"to": "$number(msg.payload)\t",
131+
"tot": "jsonata"
132+
}
133+
],
134+
"action": "",
135+
"property": "",
136+
"from": "",
137+
"to": "",
138+
"reg": false,
139+
"x": 240,
140+
"y": 400,
141+
"wires": [
142+
[
143+
"265dad1b49bf62e0",
144+
"c391139336c95d0a"
145+
]
146+
]
147+
},
148+
{
149+
"id": "a6208c41dc75af25",
150+
"type": "serial-port",
151+
"name": "arduino",
152+
"serialport": "COM4",
153+
"serialbaud": "9600",
154+
"databits": 8,
155+
"parity": "none",
156+
"stopbits": 1,
157+
"waitfor": "",
158+
"dtr": "none",
159+
"rts": "none",
160+
"cts": "none",
161+
"dsr": "none",
162+
"newline": "\\n",
163+
"bin": "false",
164+
"out": "char",
165+
"addchar": "",
166+
"responsetimeout": 10000
167+
},
168+
{
169+
"id": "992f56c535718c90",
170+
"type": "ui_group",
171+
"name": "Default",
172+
"tab": "cf8e96118638b6fa",
173+
"order": 1,
174+
"disp": true,
175+
"width": 6,
176+
"collapse": false,
177+
"className": ""
178+
},
179+
{
180+
"id": "cf8e96118638b6fa",
181+
"type": "ui_tab",
182+
"name": "Home",
183+
"icon": "dashboard",
184+
"disabled": false,
185+
"hidden": false
186+
}
187+
]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
void setup() {
2+
Serial.begin(9600);
3+
}
4+
5+
void loop() {
6+
if (Serial.available() > 0) {
7+
int val = Serial.parseInt();
8+
if (val >= 0 && val <= 245) {
9+
analogWrite(10, val);
10+
}
11+
while (Serial.available() > 0) {
12+
Serial.read();
13+
}
14+
}
15+
}

0 commit comments

Comments
 (0)