Code Snippets

1] Creating two streams on Adafruit to records the temperature and humidity
=> AdafruitIO_Feed *temp = io.feed("temperature");
=> AdafruitIO_Feed *humid = io.feed("humidity");

2] Initialising the pins on NodeMCU corresponding to the DHT11 temperature and humidity sensor and the active buzzer
=> #define DHT11PIN 14
=> dht11 DHT11;
=> const int buzzer = 4;

3] Making the alarm buzz if the temperature or the humidity goes above a certain threshold
=> if ((float)DHT11.temperature > 10 || (float)DHT11.humidity > 40){
=>   digitalWrite(buzzer,HIGH);
=> }

4] Writing the values of temperature and humidity to Adafruit streams
=> temp->save((float)DHT11.temperature);
=> delay(2000);
=> humid->save((float)DHT11.humidity);

Link to code: link

Link to 2 minute Video Describing the Project: link

*Video includes description, uses, demonstration, hardware used, software used, and challenges

Built With

Share this project:

Updates