Inverted Indicator Pin Logic
Indicator pins are now off when output is HIGH and on when output is LOW
This commit is contained in:
11
src/main.cpp
11
src/main.cpp
@@ -150,6 +150,9 @@ void setup() {
|
|||||||
pinMode(armed_indicator_pin, OUTPUT);
|
pinMode(armed_indicator_pin, OUTPUT);
|
||||||
pinMode(fired_indicator_pin, OUTPUT);
|
pinMode(fired_indicator_pin, OUTPUT);
|
||||||
|
|
||||||
|
// Set the indicator pins off (Inverted logic)
|
||||||
|
digitalWrite(armed_indicator_pin, HIGH);
|
||||||
|
digitalWrite(fired_indicator_pin, HIGH);
|
||||||
//Set up interrupts to simplify single fire mode:
|
//Set up interrupts to simplify single fire mode:
|
||||||
// This will call the arm_single_fire() function whenever it detects a falling signal on this pin
|
// This will call the arm_single_fire() function whenever it detects a falling signal on this pin
|
||||||
//attachInterrupt(digitalPinToInterrupt(single_pulse_arm_pin), arm_single_fire, FALLING);
|
//attachInterrupt(digitalPinToInterrupt(single_pulse_arm_pin), arm_single_fire, FALLING);
|
||||||
@@ -299,7 +302,7 @@ void loop() {
|
|||||||
}
|
}
|
||||||
else lcd.print("No ");
|
else lcd.print("No ");
|
||||||
//Output the armed state to the arm pin
|
//Output the armed state to the arm pin
|
||||||
digitalWrite(armed_indicator_pin, is_armed);
|
digitalWrite(armed_indicator_pin, !is_armed);
|
||||||
//Set the timer so this if statement doesn't run again
|
//Set the timer so this if statement doesn't run again
|
||||||
armed_debounce = millis()-301;
|
armed_debounce = millis()-301;
|
||||||
}
|
}
|
||||||
@@ -313,7 +316,7 @@ void loop() {
|
|||||||
//Once the debounce timer reaches 250ms toggle the armed state.
|
//Once the debounce timer reaches 250ms toggle the armed state.
|
||||||
if(millis()-fire_debounce > 200 && millis()-fire_debounce < 300){
|
if(millis()-fire_debounce > 200 && millis()-fire_debounce < 300){
|
||||||
|
|
||||||
digitalWrite(fired_indicator_pin, HIGH);
|
digitalWrite(fired_indicator_pin, LOW);
|
||||||
//Send out pulse
|
//Send out pulse
|
||||||
generate_waveform(sample_resolution);
|
generate_waveform(sample_resolution);
|
||||||
// Toggle the armed state
|
// Toggle the armed state
|
||||||
@@ -322,7 +325,7 @@ void loop() {
|
|||||||
lcd.setCursor(7,1);
|
lcd.setCursor(7,1);
|
||||||
lcd.print("No ");
|
lcd.print("No ");
|
||||||
//Output the state to the indicator lights
|
//Output the state to the indicator lights
|
||||||
digitalWrite(armed_indicator_pin, LOW);
|
digitalWrite(armed_indicator_pin, HIGH);
|
||||||
//Set the timer so this if statement doesn't run again
|
//Set the timer so this if statement doesn't run again
|
||||||
fire_debounce = millis()-301;
|
fire_debounce = millis()-301;
|
||||||
armed_debounce = millis();
|
armed_debounce = millis();
|
||||||
@@ -331,7 +334,7 @@ void loop() {
|
|||||||
|
|
||||||
// Turn off the fire indicator pin after a half of a second
|
// Turn off the fire indicator pin after a half of a second
|
||||||
if(millis()-fire_debounce>300+500){
|
if(millis()-fire_debounce>300+500){
|
||||||
digitalWrite(fired_indicator_pin, LOW);
|
digitalWrite(fired_indicator_pin, HIGH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user