/* Arduino Projects for Dummies * by Brock Craft * * Chapter 12: Building a Home Sensing Station * Reads values from Analog Sensors on Pins 2,3 and 4 * Posts these values as three datastreams to * a single Xively feed. * * This code is just for testing an calibrating your * temperature and light sensors * * v0.1 14.05.2013 */ const int lightSensorPin=2; const int tempPin1=3; const int tempPin2=4; void setup() { Serial.begin(9600); } void loop() { float lightLevel = map(analogRead(lightSensorPin),0,1023,0,100); float temperature1 = ((getVoltage(tempPin1) -.5) * 100L); float temperature2 = ((getVoltage(tempPin2) -.5) * 100L); Serial.print("Temp 1 ('C): "); Serial.print(temperature1); Serial.print(", Temp 2 ('C): "); Serial.print(temperature2); Serial.print(", Light (V): "); Serial.println(lightLevel); delay(250); } float getVoltage(int pin){ return (analogRead(pin) * .004882814); }