From 261cd787a2c81663849b6638be5f5b444a8e9ad0 Mon Sep 17 00:00:00 2001 From: Bernhard Tittelbach Date: Thu, 12 Aug 2010 00:01:04 +0000 Subject: [PATCH] +aref .... PanicButton....Panic-Led . . -pin 7 -pwmpin 6 --- rf433ctl/Makefile | 2 +- rf433ctl/rf433ctl.pde | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/rf433ctl/Makefile b/rf433ctl/Makefile index 2b06faf..c5dc50e 100755 --- a/rf433ctl/Makefile +++ b/rf433ctl/Makefile @@ -209,6 +209,6 @@ depend: $(CC) -M -mmcu=$(MCU) $(CDEFS) $(CINCS) $(SRC) $(ASRC) >> $(MAKEFILE) reset_tty: reset_tty.c - $(CC) -o reset_tty reset_tty.c + $(CC) -L /usr/lib/ -L /lib -I /usr/include/ -o reset_tty reset_tty.c .PHONY: all build elf hex eep lss sym program coff extcoff clean depend applet_files sizebefore sizeafter diff --git a/rf433ctl/rf433ctl.pde b/rf433ctl/rf433ctl.pde index b442b96..ca214f7 100644 --- a/rf433ctl/rf433ctl.pde +++ b/rf433ctl/rf433ctl.pde @@ -11,7 +11,8 @@ #define IR_MOVEMENT_PIN 9 #define ONE_WIRE_PIN 8 #define PANIC_BUTTON_PIN 7 -#define BLUELED_PWM_PIN 6 +#define BLUELED_PWM_PIN 5 +#define PANICLED_PWM_PIN 6 #define BLUELED2_PWM_PIN 11 #define PHOTO_ANALOGPIN 0 //movement is reported if during IR_SAMPLE_DURATION at least IR_TRESHOLD ir signals are detectd @@ -355,9 +356,9 @@ void calculate_led_level(unsigned int pwm_pin) if (flash_led_brightness_ == 255) { if (flash_led_time_) - analogWrite(BLUELED_PWM_PIN, 255-c); + analogWrite(PANICLED_PWM_PIN, c); else - analogWrite(BLUELED_PWM_PIN, c); + analogWrite(PANICLED_PWM_PIN, 255-c); } } @@ -379,10 +380,11 @@ void setup() pinMode(RF_DATA_OUT_PIN, OUTPUT); digitalWrite(RF_DATA_OUT_PIN, HIGH); pinMode(IR_MOVEMENT_PIN, INPUT); // set pin to input - digitalWrite(IR_MOVEMENT_PIN, LOW); // turn off pullup resistors + digitalWrite(IR_MOVEMENT_PIN, LOW); // turn off pulldown resistors pinMode(PANIC_BUTTON_PIN, INPUT); // set pin to input - digitalWrite(PANIC_BUTTON_PIN, HIGH); // turn on pullup resistors - analogWrite(BLUELED_PWM_PIN,0); + digitalWrite(PANIC_BUTTON_PIN, LOW); // turn on pulldown resistors + analogWrite(BLUELED_PWM_PIN,255); + analogWrite(PANICLED_PWM_PIN,255); analogWrite(BLUELED2_PWM_PIN,255); //pwm sink(-) instead of pwm + (better for mosfets) pinMode(IRREMOTE_SEND_PIN, OUTPUT); digitalWrite(IRREMOTE_SEND_PIN, HIGH); @@ -419,7 +421,7 @@ void loop() if (pb_time < PB_TRESHOLD) pb_time++; - pb_state=(digitalRead(PANIC_BUTTON_PIN) == LOW); + pb_state=(digitalRead(PANIC_BUTTON_PIN) == HIGH); if (ir_time == 0) { @@ -438,7 +440,7 @@ void loop() { pb_postth_state=1; Serial.println("PanicButton"); - flash_led(7,1,2); + flash_led(14,1,2); } else if (!pb_state) pb_postth_state=0; @@ -450,7 +452,7 @@ void loop() } updateLightLevel(PHOTO_ANALOGPIN); - calculate_led_level(BLUELED_PWM_PIN); + calculate_led_level(PANICLED_PWM_PIN); check_frame_done(); if(Serial.available()) { -- 1.7.10.4