Étape 7 : Installation du récepteur UNO
Télécharger la bibliothèque Billy d’ici
Télécharger VirtualWire bibliothèque d’ici
Télécharger le Code de ici
ou d’afficher le code ci-dessous
#include <SPI.h>#include <Ethernet.h> #include <BlynkSimpleEthernet.h> #include <VirtualWire.h> #include <Wire.h>int TEMP;int tempurature; int humidity;char auth[] = "9bb52b5cfa6b4c4bbcde617a64886ed5";void setup() { Serial.begin(9600); vw_set_rx_pin(2); vw_setup(2000); vw_rx_start(); Blynk.begin(auth); }void loop() { Blynk.run(); uint8_t buf[VW_MAX_MESSAGE_LEN]; uint8_t buflen = VW_MAX_MESSAGE_LEN; if (vw_get_message(buf, &buflen)) // Non-blocking { int i; char c; String input; for (i = 0; i < buflen; i++) { c = ((char)buf[i]); input += ((char)buf[i]); //Serial.print((char)buf[i]); } if (c == 'p') { Serial.print("TEMPURATURE CHECK"); TEMP = true; } if (c == 'i') { Serial.print("HUMIDITY CHECK"); TEMP = false; } if (c != 'p' && c != 'i') { if (TEMP == true) { tempurature = input.toInt(); if (tempurature != humidity) { Blynk.virtualWrite(V12, tempurature); } Serial.print(tempurature); } else { humidity = input.toInt(); if (tempurature != humidity) { Blynk.virtualWrite(V13, humidity); } Serial.print(humidity); /*double celsius = (tempurature - 32) * 5/9; double a = 17.271; double b = 237.7; double temp2 = (a * celsius) / (b + celsius) + log(humidity*0.01); double Td = (b * temp2) / (a - temp2); Td = ((Td*9) / 5) + 32; Blynk.virtualWrite(V14, Td); */ } } Serial.println(); } }