You can customize this code to suit whichever sensors you may have in your project, or even display the sensor values on a display module to make your own room thermometer and humidity meter. write(temperature) // Send temperature data to master readTemperature() // Read temperature from DHT sensor # define DHTTYPE DHT11 // DHT sensor typeĭelay( 2000) // Wait for 2 seconds for DHT to stabilize # define DHTPIN 4 // Pin connected to DHT sensor read() // Read temperature data from slaveĭelay( 2000) // Wait for 2 seconds before requesting temperature again requestFrom( 8, 1) // Request temperature data from slaveīyte temperature = Wire. The master board can then read the value we sent, then display it on the serial monitor. Let's modify the code we wrote earlier to include the temperature measurement which we will then send to the master board over the I2C bus.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |