-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHalloween.ino
103 lines (84 loc) · 2.59 KB
/
Halloween.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
/* Project: Halloween Pumpkin IoT Lights
* :Author: Aude Vuilliomenet - GardenofThings
* :Date: 26/10/2020
* :License: Public Domain
* :Thanks to: Other IoT Open Projects -
"Bright Ball IoT" by Tiziano Bianchettin,
"WifiRTC & Sleep RTC Alarm" by Arturo Guadalupi
*/
#include <SPI.h> // Library to communicate with SPI devices.
#include <WiFi101.h> // Library to connect Arduino MKR1000 to the Internet through WiFi.
#include <BlynkSimpleMKR1000.h>
#include <Adafruit_NeoPixel.h> // Library to control NeoPixel.
/*** Connect Arduino to WiFi and Blynk App ***/
#include "auth_password.h"
int status = WL_IDLE_STATUS; // Check Wifi Status
/*** Defind NeoPixel Object ***/
#define LED_PIN 4
#define LED_COUNT 12
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
/*** Add Separated Tab - Color LEDs ***/
#include "color_LEDs.h"
/*** ---- ARDUINO SETUP FUNCTION ---- ***/
void setup() {
Serial.begin(9600);
delay(1500);
/*** Check Wifi Status ***/
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
// don't continue:
while (true);
}
// Try to connect to WiFi network:
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network.
status = WiFi.begin(ssid, pass);
// wait 10 seconds for connection:
delay(10000);
}
// Connection work. Print out the Wifi status.
printWiFiStatus();
/*** Blynk App Connection ***/
Blynk.begin(auth, ssid, pass);
/*** NeoPixel Initialise ***/
pixels.begin();
pixels.setBrightness(60);
pixels.show(); // Initialize all pixels to 'off'
Serial.print("LED Init.");
}
/*** ---- ARDUINO SETUP FUNCTION ---- ***/
void loop() {
/*** Run Blynk App ***/
Blynk.run();
delay(100);
}
/*** Blynk - Connect to VirtualPin - Call Function ***/
BLYNK_WRITE(V1) {
rainbow(20); }
BLYNK_WRITE(V2) {
Harlequin(); }
BLYNK_WRITE(V3) {
RazzleDazzleRose(); }
BLYNK_WRITE(V4) {
Pumpkin(); }
BLYNK_WRITE(V5) {
VividSky(); }
BLYNK_WRITE(V6) {
TwinkleRandom(50,5); }
/*** Wifi Status Function ***/
void printWiFiStatus() {
// print the SSID of the network you're attached to:
Serial.print("SSID: ");
Serial.println(WiFi.SSID());
// print your WiFi shield's IP address:
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);
// print the received signal strength:
long rssi = WiFi.RSSI();
Serial.print("signal strength (RSSI):");
Serial.print(rssi);
Serial.println(" dBm");
}