├── .gitattributes └── NodeMCU_with_voiceflow └── NodeMCU_with_voiceflow.ino /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /NodeMCU_with_voiceflow/NodeMCU_with_voiceflow.ino: -------------------------------------------------------------------------------- 1 | /* 2 | This is the code for controlling 4 appliances and 3 | sending DHT11 sensor's data to Blynk App. 4 | 5 | After that, I made my own voice app using which, I 6 | can directly ask the status of appliances and value 7 | of Temeprature and Humidity directly to my Alexa 8 | smart speaker. 9 | 10 | You can visit the channel to see 11 | complete tutorial on making this project 12 | by yoursleves 13 | 14 | YouTube Channel :- https://www.youtube.com/techiesms 15 | 16 | 17 | techiesms 18 | explore | learn | share 19 | */ 20 | 21 | /* Comment this out to disable prints and save space */ 22 | #define BLYNK_PRINT Serial 23 | 24 | #include "DHT.h" 25 | 26 | #define DHTPIN D7 27 | 28 | #define DHTTYPE DHT11 29 | 30 | DHT dht(DHTPIN, DHTTYPE); 31 | //#include 32 | //#include 33 | #include 34 | #include 35 | BlynkTimer timer; 36 | 37 | // You should get Auth Token in the Blynk App. 38 | // Go to the Project Settings (nut icon). 39 | char auth[] = "AUTH_TOKEN"; 40 | 41 | // Your WiFi credentials. 42 | // Set password to "" for open networks. 43 | char ssid[] = "SSID"; 44 | char pass[] = "PASS"; 45 | #define switchone D6 46 | #define switchtwo D2 47 | #define switchthree D1 48 | #define switchfour D5 49 | 50 | void sendSensor() 51 | { 52 | float h = dht.readHumidity(); 53 | float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit 54 | 55 | if (isnan(h) || isnan(t)) { 56 | Serial.println("Failed to read from DHT sensor!"); 57 | return; 58 | } 59 | // You can send any value at any time. 60 | // Please don't send more that 10 values per second. 61 | Blynk.virtualWrite(V5, t); 62 | Blynk.virtualWrite(V6, h); 63 | } 64 | 65 | BLYNK_WRITE(V1) 66 | { 67 | int pinValue = param.asInt(); 68 | digitalWrite(switchone,pinValue); 69 | } 70 | 71 | BLYNK_WRITE(V2) 72 | { 73 | int pinValue = param.asInt(); 74 | digitalWrite(switchtwo,pinValue); 75 | } 76 | 77 | BLYNK_WRITE(V3) 78 | { 79 | int pinValue = param.asInt(); 80 | digitalWrite(switchthree,pinValue); 81 | } 82 | 83 | BLYNK_WRITE(V4) 84 | { 85 | int pinValue = param.asInt(); 86 | digitalWrite(switchfour,pinValue); 87 | } 88 | 89 | void setup() 90 | { 91 | // Debug console 92 | Serial.begin(9600); 93 | pinMode(switchone,OUTPUT); 94 | pinMode(switchtwo,OUTPUT); 95 | pinMode(switchthree,OUTPUT); 96 | pinMode(switchfour,OUTPUT); 97 | digitalWrite(switchone,LOW); 98 | digitalWrite(switchtwo,LOW); 99 | digitalWrite(switchthree,LOW); 100 | digitalWrite(switchfour,LOW); 101 | Blynk.begin(auth, ssid, pass); 102 | dht.begin(); 103 | // Setup a function to be called every second 104 | timer.setInterval(1000L, sendSensor); 105 | 106 | } 107 | 108 | void loop() 109 | { 110 | Blynk.run(); 111 | timer.run(); 112 | 113 | } 114 | --------------------------------------------------------------------------------