1 /* Arduino Projects for Dummies
4 * Chapter 12: Building a Home Sensing Station
5 * Reads values from Analog Sensors on Pins 2,3 and 4
6 * Posts these values as three datastreams to
7 * a single Xively feed.
9 * This code is just for testing an calibrating your
10 * temperature and light sensors
15 const int lightSensorPin=2;
24 float lightLevel = map(analogRead(lightSensorPin),0,1023,0,100);
26 float temperature1 = ((getVoltage(tempPin1) -.5) * 100L);
27 float temperature2 = ((getVoltage(tempPin2) -.5) * 100L);
29 Serial.print("Temp 1 ('C): ");
30 Serial.print(temperature1);
31 Serial.print(", Temp 2 ('C): ");
32 Serial.print(temperature2);
33 Serial.print(", Light (V): ");
34 Serial.println(lightLevel);
38 float getVoltage(int pin){
39 return (analogRead(pin) * .004882814);