Add function on/off light support camera
This commit is contained in:
parent
d702b4018a
commit
732bd382ce
|
@ -46,6 +46,27 @@
|
||||||
// #include <Servo.h>
|
// #include <Servo.h>
|
||||||
|
|
||||||
//#define COMMON_ANODE
|
//#define COMMON_ANODE
|
||||||
|
// Ver 1
|
||||||
|
//#ifdef COMMON_ANODE
|
||||||
|
//#define LED_ON LOW
|
||||||
|
//#define LED_OFF HIGH
|
||||||
|
//#else
|
||||||
|
//#define LED_ON HIGH
|
||||||
|
//#define LED_OFF LOW
|
||||||
|
//#endif
|
||||||
|
//
|
||||||
|
//#define Light 7
|
||||||
|
//#define ledView 13
|
||||||
|
//
|
||||||
|
//#define redLed 3 // Set Led Pins
|
||||||
|
//#define greenLed 6
|
||||||
|
//#define blueLed 5
|
||||||
|
//
|
||||||
|
//#define relay A2 //8 // Set Relay Pin
|
||||||
|
//#define wipeB 2 // Button pin for WipeMode
|
||||||
|
//#define button 7 // button exit
|
||||||
|
/ --------------------------------------------
|
||||||
|
//Ver 2
|
||||||
|
|
||||||
#ifdef COMMON_ANODE
|
#ifdef COMMON_ANODE
|
||||||
#define LED_ON LOW
|
#define LED_ON LOW
|
||||||
|
@ -55,15 +76,19 @@
|
||||||
#define LED_OFF LOW
|
#define LED_OFF LOW
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ledView 13
|
#define redLed 4 // Set Led Pins
|
||||||
|
#define greenLed 2
|
||||||
|
#define blueLed 3
|
||||||
|
|
||||||
#define redLed 3 // Set Led Pins
|
#define relay 5 //6 // Set Relay Pin
|
||||||
#define greenLed 6
|
#define wipeB A0 // Button pin for WipeMode
|
||||||
#define blueLed 5
|
#define button A1 // button exit
|
||||||
|
#define Light 7 // Led tro sang camera
|
||||||
|
|
||||||
#define relay A2 //8 // Set Relay Pin
|
|
||||||
#define wipeB 2 // Button pin for WipeMode
|
|
||||||
#define button 7 // button exit
|
|
||||||
|
bool Light_stt = false;
|
||||||
bool relay_stt = false;
|
bool relay_stt = false;
|
||||||
bool sttRun = false;
|
bool sttRun = false;
|
||||||
bool programMode = false; // initialize programming mode to false
|
bool programMode = false; // initialize programming mode to false
|
||||||
|
@ -85,6 +110,7 @@ bool Debug = false;
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
pinMode(13, OUTPUT);
|
pinMode(13, OUTPUT);
|
||||||
|
pinMode(Light, OUTPUT);
|
||||||
digitalWrite(13, LOW);
|
digitalWrite(13, LOW);
|
||||||
//Arduino Pin Configuration
|
//Arduino Pin Configuration
|
||||||
pinMode(ledView, OUTPUT);
|
pinMode(ledView, OUTPUT);
|
||||||
|
@ -108,7 +134,7 @@ void setup()
|
||||||
//Protocol Configuration
|
//Protocol Configuration
|
||||||
Serial.begin(9600); // Initialize serial communications with PC
|
Serial.begin(9600); // Initialize serial communications with PC
|
||||||
|
|
||||||
/*
|
|
||||||
SPI.begin(); // MFRC522 Hardware uses SPI protocol
|
SPI.begin(); // MFRC522 Hardware uses SPI protocol
|
||||||
mfrc522.PCD_Init(); // Initialize MFRC522 Hardware
|
mfrc522.PCD_Init(); // Initialize MFRC522 Hardware
|
||||||
if (Debug == true)
|
if (Debug == true)
|
||||||
|
@ -217,9 +243,10 @@ void setup()
|
||||||
cycleLeds(); // Everything ready lets give user some feedback by cycling leds
|
cycleLeds(); // Everything ready lets give user some feedback by cycling leds
|
||||||
// }
|
// }
|
||||||
// wdt_enable(WDTO_500MS);
|
// wdt_enable(WDTO_500MS);
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
//void SerialRead();
|
||||||
|
//void ReadButton();
|
||||||
///////////////////////////////////////// Main Loop ///////////////////////////////////
|
///////////////////////////////////////// Main Loop ///////////////////////////////////
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
|
@ -227,7 +254,7 @@ void loop()
|
||||||
{
|
{
|
||||||
ReadButton();
|
ReadButton();
|
||||||
SerialRead();
|
SerialRead();
|
||||||
/*
|
|
||||||
successRead = getID(); // sets successRead to 1 when we get read from reader otherwise 0
|
successRead = getID(); // sets successRead to 1 when we get read from reader otherwise 0
|
||||||
// When device is in use if wipe button pressed for 10 seconds initialize Master Card wiping
|
// When device is in use if wipe button pressed for 10 seconds initialize Master Card wiping
|
||||||
if (digitalRead(wipeB) == LOW)
|
if (digitalRead(wipeB) == LOW)
|
||||||
|
@ -327,12 +354,22 @@ void loop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
// wdt_reset();
|
// wdt_reset();
|
||||||
//}
|
//}
|
||||||
|
|
||||||
///////////////////////////////////////// Access Granted ///////////////////////////////////
|
///////////////////////////////////////// Access Granted ///////////////////////////////////
|
||||||
|
// Turn on Light camera
|
||||||
|
void TurnOn_Light() {
|
||||||
|
digitalWrite(Light, LOW);
|
||||||
|
Light_stt = true;
|
||||||
|
}
|
||||||
|
void TurnOff_Light() {
|
||||||
|
digitalWrite(Light, HIGH);
|
||||||
|
Light_stt = false;
|
||||||
|
}
|
||||||
|
|
||||||
void granted(uint16_t setDelay)
|
void granted(uint16_t setDelay)
|
||||||
{
|
{
|
||||||
digitalWrite(blueLed, LED_OFF); // Turn off blue LED
|
digitalWrite(blueLed, LED_OFF); // Turn off blue LED
|
||||||
|
@ -659,7 +696,17 @@ void loop()
|
||||||
{
|
{
|
||||||
input = Serial.readStringUntil('\r');
|
input = Serial.readStringUntil('\r');
|
||||||
Serial.println(input);
|
Serial.println(input);
|
||||||
if (input == "1")
|
if (input == "2") {
|
||||||
|
if (Light_stt == false) {
|
||||||
|
TurnOn_Light();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (input == "3") {
|
||||||
|
if (Light_stt == true) {
|
||||||
|
TurnOff_Light();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (input == "1")
|
||||||
{
|
{
|
||||||
Serial.println("open");
|
Serial.println("open");
|
||||||
if (relay_stt == false)
|
if (relay_stt == false)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user