Skip to content

Instantly share code, notes, and snippets.

@evilmachina
evilmachina / TMP36.device.nut
Created September 1, 2013 07:53
Electric Imp TMP36 Thermometer Thingspeak Logger
hardware.pin9.configure(ANALOG_IN);
function getTemp() {
local supplyVoltage = hardware.voltage();
local voltage = supplyVoltage * hardware.pin9.read() / 65535.0;
local c = (voltage - 0.5) * 100 ;
local c_str = format("%.01f", c);
server.log("Current temp is "+c_str+" °C");