-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathdata_shields.js
548 lines (513 loc) · 13.9 KB
/
data_shields.js
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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
'use strict';
const shields = {
/***********************************************************/
"--- Ethernet" : {},
/***********************************************************/
"Ethernet Shield W5100" : {
name: "Arduino Ethernet Shield",
comment: `
This example shows how to use Arduino Ethernet shield (W5100)
to connect your project to Blynk.
NOTE: Pins 10, 11, 12 and 13 are reserved for Ethernet module.
DON'T use them in your sketch directly!
WARNING: If you have an SD card, you may need to disable it
by setting pin 4 to HIGH. Read more here:
https://www.arduino.cc/en/Main/ArduinoEthernetShield
`,
inc: `
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
`,
glob : `
#define W5100_CS 10
#define SDCARD_CS 4
`,
init: `
pinMode(SDCARD_CS, OUTPUT);
digitalWrite(SDCARD_CS, HIGH); // Deselect the SD card
Blynk.begin(BLYNK_AUTH_TOKEN);
// You can also specify server:
//Blynk.begin(BLYNK_AUTH_TOKEN, "blynk.cloud", 80);
//Blynk.begin(BLYNK_AUTH_TOKEN, IPAddress(192,168,1,100), 8080);
`
},
/***********************************************/
"ENC28J60" : {
comment : `
For this example you need UIPEthernet library:
https://github.com/UIPEthernet/UIPEthernet
Typical wiring would be (this is for Arduino UNO,
search for correct wiring for your board):
VCC -- 5V
GND -- GND
CS -- D10
SI -- D11
SCK -- D13
SO -- D12
INT -- D2
`,
inc: `
#include <UIPEthernet.h>
#include <BlynkSimpleUIPEthernet.h>
`,
init: `
Blynk.begin(BLYNK_AUTH_TOKEN);
// You can also specify server:
//Blynk.begin(BLYNK_AUTH_TOKEN, "blynk.cloud", 80);
//Blynk.begin(BLYNK_AUTH_TOKEN, IPAddress(192,168,1,100), 8080);
`
},
/***********************************************************/
"--- WiFi" : {},
/***********************************************************/
"Arduino WiFi Shield 101" : {
inc: `
#include <SPI.h>
#include <WiFi101.h>
#include <BlynkSimpleWiFiShield101.h>
`,
inherit : "Arduino WiFi Shield"
},
/***********************************************/
"Arduino WiFi Shield" : {
inc: `
#include <SPI.h>
#include <WiFi.h>
#include <BlynkSimpleWifi.h>
`,
glob : `
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";
`,
init: `
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
// You can also specify server:
//Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, "blynk.cloud", 80);
//Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, IPAddress(192,168,1,100), 8080);
`
},
/***********************************************/
"ESP8266 WiFi Shield" : {
comment: `
WARNING!
It's very tricky to get it working. Please read this article:
http://help.blynk.cc/hardware-and-libraries/arduino/esp8266-with-at-firmware
`,
inc: `
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
`,
glob : `
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";
// Hardware Serial on Mega, Leonardo, Micro...
#define EspSerial Serial1
// or Software Serial on Uno, Nano...
//#include <SoftwareSerial.h>
//SoftwareSerial EspSerial(2, 3); // RX, TX
// Your ESP8266 baud rate:
#define ESP8266_BAUD 38400
ESP8266 wifi(&EspSerial);
`,
init: `
// Set ESP8266 baud rate
EspSerial.begin(ESP8266_BAUD);
delay(10);
Blynk.begin(BLYNK_AUTH_TOKEN, wifi, ssid, pass);
// You can also specify server:
//Blynk.begin(BLYNK_AUTH_TOKEN, wifi, ssid, pass, "blynk.cloud", 80);
//Blynk.begin(BLYNK_AUTH_TOKEN, wifi, ssid, pass, IPAddress(192,168,1,100), 8080);
`
},
/***********************************************/
"RN-XV WiFly" : {
comment: `
For this example you need WiFlyHQ library:
https://github.com/harlequin-tech/WiFlyHQ
Note: Ensure a stable serial connection!
Hardware serial is preferred.
Firmware version 4.41 or later is preferred.
`,
inc: `
#include <WiFlyHQ.h>
#include <BlynkSimpleWiFly.h>
`,
glob : `
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";
#define WiFlySerial Serial1
// This can be a SoftwareSerial object:
//#include <SoftwareSerial.h>
//SoftwareSerial WiFlySerial(2, 3); // RX, TX
WiFly wifly;
`,
init: `
WiFlySerial.begin(9600); // Set your RN-XV baud rate
delay(10);
// Bind WiFly driver to the serial
if (!wifly.begin(&WiFlySerial)) {
BLYNK_FATAL("Failed to start wifly");
}
// You can try increasing baud rate:
//wifly.setBaud(115200);
//WiFlySerial.begin(115200);
Blynk.begin(BLYNK_AUTH_TOKEN, wifly, ssid, pass);
`
},
/***********************************************************/
"--- Cellular" : {},
/***********************************************************/
"SimCOM SIM800" : {
comment: `
Attention! Please check out TinyGSM guide:
https://tiny.cc/tinygsm-readme
Change GPRS apm, user, pass, and Blynk auth token to run :)
`,
defs: `
#define TINY_GSM_MODEM_SIM800
`,
inc: `
// Default heartbeat interval for GSM is 60
// If you want override this value, uncomment and set this option:
//#define BLYNK_HEARTBEAT 30
#include <TinyGsmClient.h>
#include <BlynkSimpleTinyGSM.h>
`,
glob : `
// Your GPRS credentials
// Leave empty, if missing user or pass
char apn[] = "YourAPN";
char user[] = "";
char pass[] = "";
// Hardware Serial on Mega, Leonardo, Micro
#define SerialAT Serial1
// or Software Serial on Uno, Nano
//#include <SoftwareSerial.h>
//SoftwareSerial SerialAT(2, 3); // RX, TX
TinyGsm modem(SerialAT);
`,
init: `
delay(10);
// Set GSM module baud rate
SerialAT.begin(115200);
delay(3000);
// Restart takes quite some time
// To skip it, call init() instead of restart()
Serial.println("Initializing modem...");
modem.restart();
// Unlock your SIM card with a PIN
//modem.simUnlock("1234");
Blynk.begin(BLYNK_AUTH_TOKEN, modem, apn, user, pass);
`
},
/***********************************************/
"SimCOM SIM900" : {
defs: `
#define TINY_GSM_MODEM_SIM900
`,
inherit: "SimCOM SIM800"
},
/***********************************************/
"Neoway M590" : {
defs: `
#define TINY_GSM_MODEM_M590
`,
inherit: "SimCOM SIM800"
},
/***********************************************************/
"--- Serial" : {},
/***********************************************************/
"Serial or USB" : {
need_serial: true,
swap_serial: true,
name: "Hardware Serial or USB",
comment : ``,
inc: `
#include <BlynkSimpleStream.h>
`,
init: `
// Blynk will work through <%= serial_dat %>
// Do not read or write this serial manually in your sketch
<%= serial_dat %>.begin(9600);
Blynk.begin(<%= serial_dat %>, BLYNK_AUTH_TOKEN);
`
},
/***********************************************/
"Serial1" : {
name: "Hardware Serial1",
comment : ``,
inc: `
#include <BlynkSimpleStream.h>
`,
init: `
// Blynk will work through Serial1
// Do not read or write this serial manually in your sketch
Serial1.begin(9600);
Blynk.begin(Serial1, BLYNK_AUTH_TOKEN);
`
},
/***********************************************/
"SoftwareSerial" : {
comment : ``,
inc: `
#include <BlynkSimpleStream.h>
#include <SoftwareSerial.h>
`,
glob : `
SoftwareSerial SwSerial(10, 11); // RX, TX
`,
init: `
// Blynk will work through SoftwareSerial
// Do not read or write this serial manually in your sketch
SwSerial.begin(9600);
Blynk.begin(SwSerial, BLYNK_AUTH_TOKEN);
`
},
/***********************************************************
* EMBEDDED
***********************************************************/
"Default" : {
embedded: true,
name: "Arduino Ethernet Shield",
inc: `
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
`,
init: `
Blynk.begin(BLYNK_AUTH_TOKEN);
`
},
/***********************************************/
"System default" : {
// Empty
embedded: true
},
"ESP8266 WiFi" : {
embedded: true,
inc: `
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
`,
glob : `
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";
`,
init: `
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
// You can also specify server:
//Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, "blynk.cloud", 80);
//Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, IPAddress(192,168,1,100), 8080);
`
},
/***********************************************/
"ESP8266 WiFi (SSL)" : {
embedded: true,
inc: `
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266_SSL.h>
`,
glob : `
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";
`,
init: `
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
// You can also specify server:
//Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, "blynk.cloud", 443);
//Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, IPAddress(192,168,1,100), 8443);
`
},
/***********************************************/
"ESP32 WiFi" : {
embedded: true,
inc: `
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
`,
glob : `
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";
`,
init: `
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
// You can also specify server:
//Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, "blynk.cloud", 80);
//Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, IPAddress(192,168,1,100), 8080);
`
},
/***********************************************/
"ESP32 WiFi (SSL)" : {
embedded: true,
inc: `
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32_SSL.h>
`,
glob : `
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";
`,
init: `
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
// You can also specify server:
//Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, "blynk.cloud", 443);
//Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, IPAddress(192,168,1,100), 8443);
`
},
/***********************************************/
"WiFiNINA" : {
embedded: true,
inc: `
#include <SPI.h>
#include <WiFiNINA.h>
#include <BlynkSimpleWiFiNINA.h>
`,
glob : `
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";
`,
init: `
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
// You can also specify server:
//Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, "blynk.cloud", 80);
//Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, IPAddress(192,168,1,100), 8080);
`
},
/***********************************************/
"MKRGSM" : {
embedded: true,
comment: `
Note: This requires MKRGSM library
from https://www.arduino.cc/en/Reference/MKRGSM
`,
inc: `
#include <SPI.h>
#include <MKRGSM.h>
#include <BlynkSimpleMKRGSM.h>
`,
glob : `
// Your SIM and GPRS credentials
// Leave empty, if missing pin, user or pass
char pin[] = "";
char apn[] = "YourAPN";
char user[] = "";
char pass[] = "";
GSMClient client;
GPRS gprs;
GSM gsmAccess;
`,
init: `
Blynk.begin(BLYNK_AUTH_TOKEN, gsmAccess, gprs, client, pin, apn, user, pass);
`
},
/***********************************************/
"Yun Bridge" : {
embedded: true,
inc: `
#include <Bridge.h>
#include <BlynkSimpleYun.h>
`,
init: `
Blynk.begin(BLYNK_AUTH_TOKEN);
// You can also specify server:
//Blynk.begin(BLYNK_AUTH_TOKEN, "blynk.cloud", 80);
//Blynk.begin(BLYNK_AUTH_TOKEN, IPAddress(192,168,1,100), 8080);
`
},
/***********************************************/
"rpcWiFi" : {
embedded: true,
inc: `
#include <rpcWiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleWioTerminal.h>
`,
glob : `
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";
`,
init: `
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
// You can also specify server:
//Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, "blynk.cloud", 80);
//Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, IPAddress(192,168,1,100), 8080);
`
},
/***********************************************/
"rpcWiFi (SSL)" : {
embedded: true,
inc: `
#include <rpcWiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleWioTerminal_SSL.h>
`,
glob : `
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";
`,
init: `
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
// You can also specify server:
//Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, "blynk.cloud", 443);
//Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, IPAddress(192,168,1,100), 8443);
`
},
/***********************************************/
"Particle WiFi" : {
embedded: true,
inc: `
#include <blynk.h>
`,
init: `
delay(5000); // Allow board to settle
Blynk.begin(BLYNK_AUTH_TOKEN);
`
},
/***********************************************/
"Particle Cellular" : {
embedded: true,
inc: `
// Uncomment this, if you want to set network credentials
//#include "cellular_hal.h"
//STARTUP(cellular_credentials_set("broadband", "", "", NULL));
// Run "ping blynk.cloud", and set Blynk IP to the shown address
#define BLYNK_IP IPAddress(45,55,130,102)
// Set Blynk hertbeat interval.
// Each heartbeat uses ~90 bytes of data.
#define BLYNK_HEARTBEAT 60
// Set Particle keep-alive ping interval.
// Each ping uses 121 bytes of data.
#define PARTICLE_KEEPALIVE 20
#include <blynk.h>
`,
init: `
delay(2000);
Particle.keepAlive(PARTICLE_KEEPALIVE);
Blynk.begin(BLYNK_AUTH_TOKEN, BLYNK_IP);
`
},
};
module.exports = shields;