Hardware Reference
In-Depth Information
We will also create an instance of an Ethernet client as follows:
EthernetClient client;
Now, in the setup() function of the sketch, we will get an IP address for the Ethernet
shield via DHCP, as shown in the following code:
Serial.print("DHCP:");
if (Ethernet.begin(ethernetMACAddress) == 0) {
Serial.println("FAIL");
while(true);
}
Serial.println("OK");
delay(5000);
Start the DHT sensor with the following line:
dht.begin();
Then, in the loop() function, we will measure the temperature and humidity from the
DHT sensor and convert the measurements to strings with the following piece of code:
float h = dht.readHumidity();
float t = dht.readTemperature();
int temperature = (int)t;
int humidity = (int)h;
Serial.println("Temperature: " + String(temperature));
Serial.println("Humidity: " + String(humidity));
After the measurements are done, we will call the following function that will actually
connect to the web and log the data to our Google Docs spreadsheet. We are going to see
the details of this function that was autogenerated by Temboo in a moment:
runAppendRow(temperature, humidity);
Finally, we will also insert some delay between each measurement. I recommend using a
large delay (I chose to log data every minute for demonstration purposes) because the
Search WWH ::




Custom Search