From: Bernhard Tittelbach Date: Sat, 6 Mar 2010 15:53:02 +0000 (+0000) Subject: Photo Resistor X-Git-Url: https://git.realraum.at/?a=commitdiff_plain;h=b560238bbf967e7cc4c11c3f69010a68819ed5fe;p=svn42.git Photo Resistor --- diff --git a/rf433ctl/rf433ctl.pde b/rf433ctl/rf433ctl.pde index 9837f3e..f77efcf 100644 --- a/rf433ctl/rf433ctl.pde +++ b/rf433ctl/rf433ctl.pde @@ -10,6 +10,7 @@ #define IR_MOVEMENT_PIN 9 #define ONE_WIRE_PIN 8 #define PANIC_BUTTON_PIN 7 +#define PHOTO_ANALOGPIN 1 //movement is reported if during IR_SAMPLE_DURATION at least IR_TRESHOLD ir signals are detectd #define IR_SAMPLE_DURATION 20000 #define IR_TRESHOLD 13000 @@ -208,6 +209,14 @@ void printTemperature(DeviceAddress deviceAddress) //********************************************************************// +void printLightLevel(unsigned int pin) +{ + Serial.print("Photo: "); + Serial.println(analogRead(pin)); +} + +//********************************************************************// + void setup() { pinMode(RF_DATA_OUT_PIN, OUTPUT); @@ -308,6 +317,8 @@ void loop() send_frame(words[D2_OFF]); else if(command == 'T') printTemperature(onShieldTemp); + else if(command == 'P') + printLightLevel(PHOTO_ANALOGPIN); else Serial.println("Error: unknown command");