Reading TMP36 from AnalogDevices
Product page: http://www.analog.com/en/mems-sensors/digital-temperature-sensors/tmp36/products/product.htmlUsing AnalogPin 0 on a GHI Cerbuino Bee. The flashing LED indicates alternating read cycles.
Cerbuino product page: https://www.ghielectronics.com/catalog/product/351
Cerbuino schematic: http://www.ghielectronics.com/downloads/schematic/FEZ_Cerbuino_Bee_SCH.PDF
AnalogInput ain = new AnalogInput((Cpu.AnalogChannel)10);
ain.Scale = 3.3;
OutputPort LED;
LED = new OutputPort(cerb.Pin.PB2, true);
double temp, temperatureF;
bool last = false; while (true)It's that simple!
{
last = !last;
LED.Write(last);
temp = (ain.Read() - 0.5) * 100;
Debug.Print("TempC: " + temp);
temperatureF = (temp * 9.0 / 5.0) + 32.0;
Debug.Print("TempF: " + temperatureF);
Thread.Sleep(1500);
}
No comments:
Post a Comment