forked from blynkkk/blynk-sketch-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata_shields.js
567 lines (523 loc) · 13.8 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
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
'use strict';
const shields = {
/***********************************************************/
"--- Ethernet" : {},
/***********************************************************/
/*
"Simple Ethernet" : {
name: "Arduino Ethernet Shield",
inc: `
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
`,
init: `
Blynk.begin(auth);
`
},
*/
/***********************************************/
"Ethernet Shield W5100" : {
name: "Arduino Ethernet Shield",
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(auth);
// You can also specify server:
//Blynk.begin(auth, "blynk-cloud.com", 8442);
//Blynk.begin(auth, IPAddress(192,168,1,100), 8442);
`
},
/***********************************************/
"Ethernet Shield W5200" : {
name: "Seeed Ethernet Shield V2.0",
inc: `
#include <SPI.h>
#include <EthernetV2_0.h>
#include <BlynkSimpleEthernetV2_0.h>
`,
glob : `
#define W5200_CS 10
#define SDCARD_CS 4
`,
init: `
pinMode(SDCARD_CS, OUTPUT);
digitalWrite(SDCARD_CS, HIGH); // Deselect the SD card
Blynk.begin(auth);
// You can also specify server:
//Blynk.begin(auth, "blynk-cloud.com", 8442);
//Blynk.begin(auth, IPAddress(192,168,1,100), 8442);
`
},
/***********************************************/
"Ethernet Shield W5500" : {
inc: `
#include <SPI.h>
#include <Ethernet2.h>
#include <BlynkSimpleEthernet2.h>
`,
init: `
Blynk.begin(auth);
// You can also specify server:
//Blynk.begin(auth, "blynk-cloud.com", 8442);
//Blynk.begin(auth, IPAddress(192,168,1,100), 8442);
`
},
/***********************************************/
"ENC28J60" : {
comment : `
For this example you need UIPEthernet library:
https://github.com/ntruchsess/arduino_uip
Typical wiring would be:
VCC -- 5V
GND -- GND
CS -- D10
SI -- D11
SCK -- D13
SO -- D12
INT -- D2
`,
inc: `
#include <UIPEthernet.h>
#include <BlynkSimpleUIPEthernet.h>
`,
init: `
Blynk.begin(auth);
// You can also specify server:
//Blynk.begin(auth, "blynk-cloud.com", 8442);
//Blynk.begin(auth, IPAddress(192,168,1,100), 8442);
`
},
/***********************************************************/
"--- 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(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);
`
},
/***********************************************/
"ESP8266 WiFi Shield" : {
comment: `
WARNING!
It's rather tricky to get it working, please read this article:
https://github.com/blynkkk/blynk-library/wiki/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 115200
ESP8266 wifi(&EspSerial);
`,
init: `
// Set ESP8266 baud rate
EspSerial.begin(ESP8266_BAUD);
delay(10);
Blynk.begin(auth, wifi, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, wifi, ssid, pass, "blynk-cloud.com", 8442);
//Blynk.begin(auth, wifi, ssid, pass, IPAddress(192,168,1,100), 8442);
`
},
/***********************************************/
"CC3000" : {
comment: `
For this example you need Adafruit_CC3000_Library library:
https://github.com/adafruit/Adafruit_CC3000_Library
Note: Firmware version 1.14 or later is preferred.
`,
inc: `
// These are the interrupt and control pins for СС3000
#define ADAFRUIT_CC3000_IRQ 3
#define ADAFRUIT_CC3000_VBAT 5
#define ADAFRUIT_CC3000_CS 10
#include <SPI.h>
#include <Adafruit_CC3000.h>
#include <BlynkSimpleCC3000.h>
`,
glob : `
// Your WiFi credentials.
// Choose wifi_sec from WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";
int wifi_sec = WLAN_SEC_WPA2;
`,
init: `
Blynk.begin(auth, ssid, pass, wifi_sec);
`
},
/***********************************************/
"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.
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(auth, wifly, ssid, pass);
`
},
/***********************************************************/
"--- Bluetooth" : {},
/***********************************************************/
"nRF8001" : {
comment: `
`,
inc: `
#include <BlynkSimpleSerialBLE.h>
#include <BLEPeripheral.h>
#include "BLESerial.h"
#include <SPI.h>
`,
glob : `
// define pins (varies per shield/board)
#define BLE_REQ 10
#define BLE_RDY 2
#define BLE_RST 9
// create ble serial instance, see pinouts above
BLESerial SerialBLE(BLE_REQ, BLE_RDY, BLE_RST);
`,
init: `
SerialBLE.setLocalName("Blynk");
SerialBLE.setDeviceName("Blynk");
SerialBLE.setAppearance(0x0080);
SerialBLE.begin();
Blynk.begin(SerialBLE, auth);
Serial.println("Waiting for connections...");
`,
loop: `
SerialBLE.poll();
`
},
/***********************************************/
"HM10/HC08" : {
comment: `
This example shows how to use Serial BLE modules (HM-10, HC-08)
to connect your project to Blynk.
`,
inc: `
#include <BlynkSimpleSerialBLE.h>
#include <SoftwareSerial.h>
`,
glob : `
SoftwareSerial SerialBLE(10, 11); // RX, TX
`,
init: `
SerialBLE.begin(9600);
Blynk.begin(SerialBLE, auth);
Serial.println("Waiting for connections...");
`
},
/***********************************************/
"HC05/HC06" : {
comment: `
This example shows how to use Arduino with HC-06/HC-05
Bluetooth 2.0 Serial Port Profile (SPP) module
to connect your project to Blynk.
Note: This only works on Android! iOS does not support SPP :(
You may need to pair the module with your smartphone
via Bluetooth settings. Default pairing password is 1234
Feel free to apply it to any other example. It's simple!
NOTE: Bluetooth support is in beta!
`,
inherit: "HM10/HC08"
},
"Adafruit Bluefruit LE" : { inherit: "nRF8001" },
/***********************************************************/
"--- Cellular" : {},
/***********************************************************/
"SimCOM SIM800" : {
comment: `
This example shows how to use GSM modem
to connect your project to Blynk.
Attention! Please check out TinyGSM guide:
http://tiny.cc/tiny-gsm-readme
WARNING: GSM modem support is for BETA testing.
`,
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 <BlynkSimpleSIM800.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: `
// Set GSM module baud rate
SerialAT.begin(115200);
delay(3000);
// Restart takes quite some time
// To skip it, call init() instead of restart()
modem.restart();
// Unlock your SIM card with a PIN
//modem.simUnlock("1234");
Blynk.begin(auth, 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/USB" : {
name: "Hardware Serial / USB",
comment : `
=>
=> USB HOWTO: http://tiny.cc/BlynkUSB
=>
`,
inc: `
#include <BlynkSimpleStream.h>
`,
init: `
// Blynk will work through Serial
// Do not read or write this serial manually in your sketch
Serial.begin(9600);
Blynk.begin(Serial, auth);
`
},
/***********************************************/
"SoftwareSerial" : {
comment : `
=>
=> USB HOWTO: http://tiny.cc/BlynkUSB
=>
`,
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, auth);
`
},
/***********************************************************
* EMBEDDED
***********************************************************/
"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(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);
`
},
/***********************************************/
"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(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);
`
},
/***********************************************/
"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(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);
`
},
/***********************************************/
"Yun Bridge" : {
embedded: true,
inc: `
#include <Bridge.h>
#include <BlynkSimpleYun.h>
`,
init: `
Blynk.begin(auth);
// You can also specify server:
//Blynk.begin(auth, "blynk-cloud.com", 8442);
//Blynk.begin(auth, IPAddress(192,168,1,100), 8442);
`
},
/***********************************************/
"Particle WiFi" : {
embedded: true,
comment: `
NOTE: It is recommended to use SparkCorePolledTimer library
to make periodic actions (similar to SimpleTimer on Arduino).
`,
inc: `
#include "blynk/blynk.h"
`,
init: `
delay(5000); // Allow board to settle
Blynk.begin(auth);
`
},
/***********************************************/
"Particle Cellular" : {
embedded: true,
comment: `
NOTE: It is recommended to use SparkCorePolledTimer library
to make periodic actions (similar to SimpleTimer on Arduino).
`,
inc: `
// Uncomment this, if you want to set network credentials
//#include "cellular_hal.h"
//STARTUP(cellular_credentials_set("broadband", "", "", NULL));
// Run "ping blynk-cloud.com", 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/blynk.h"
`,
init: `
delay(2000);
Particle.keepAlive(PARTICLE_KEEPALIVE);
Blynk.begin(auth, BLYNK_IP);
`
}
/***********************************************/
//"Arduino 101 BLE" : { //TODO
//}
};
module.exports = shields;