mirror of
https://github.com/zyphlar/open-access-control-minimal-http.git
synced 2024-03-08 15:57:47 +00:00
Got shift LCD working
This commit is contained in:
parent
e91a8a0f3a
commit
2131207c09
|
@ -51,8 +51,7 @@
|
||||||
|
|
||||||
#include <WIEGAND26.h> // Wiegand 26 reader format libary
|
#include <WIEGAND26.h> // Wiegand 26 reader format libary
|
||||||
#include <PCATTACH.h> // Pcint.h implementation, allows for >2 software interupts.
|
#include <PCATTACH.h> // Pcint.h implementation, allows for >2 software interupts.
|
||||||
|
#include <ShiftLCD.h> // LCD via shift register
|
||||||
#include <LiquidCrystal.h>
|
|
||||||
|
|
||||||
// Create an instance of the various C++ libraries we are using.
|
// Create an instance of the various C++ libraries we are using.
|
||||||
WIEGAND26 wiegand26; // Wiegand26 (RFID reader serial protocol) library
|
WIEGAND26 wiegand26; // Wiegand26 (RFID reader serial protocol) library
|
||||||
|
@ -64,7 +63,10 @@ PCATTACH pcattach; // Software interrupt library
|
||||||
|
|
||||||
// pin assignments
|
// pin assignments
|
||||||
byte reader1Pins[]={2,3}; // Reader 1 pins
|
byte reader1Pins[]={2,3}; // Reader 1 pins
|
||||||
const byte relayPins[]= {6,7,8,9}; // Relay output pins
|
const byte relayPins[]= {6,7,8,9}; // Relay output pins -- fix conflict with lcd
|
||||||
|
|
||||||
|
// initialize the ShiftLCD library with the numbers of the interface pins
|
||||||
|
ShiftLCD lcd(4, 6, 5);
|
||||||
|
|
||||||
// statics
|
// statics
|
||||||
#define RELAYDELAY 1800000 // How long to open door lock once access is granted. (1000 = 1sec)
|
#define RELAYDELAY 1800000 // How long to open door lock once access is granted. (1000 = 1sec)
|
||||||
|
@ -87,10 +89,6 @@ byte server[] = { 10,1,1,1 }; // hsl-access
|
||||||
// that you want to connect to (port 80 is default for HTTP):
|
// that you want to connect to (port 80 is default for HTTP):
|
||||||
Client client(server, 80);
|
Client client(server, 80);
|
||||||
|
|
||||||
|
|
||||||
// initialize the library with the numbers of the interface pins
|
|
||||||
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
|
|
||||||
|
|
||||||
// strings for storing results from web server
|
// strings for storing results from web server
|
||||||
String httpresponse = "";
|
String httpresponse = "";
|
||||||
String username = "";
|
String username = "";
|
||||||
|
@ -125,19 +123,14 @@ void setup(){ // Runs once at Arduino boot-up
|
||||||
// start the Ethernet connection:
|
// start the Ethernet connection:
|
||||||
Ethernet.begin(mac, ip);
|
Ethernet.begin(mac, ip);
|
||||||
|
|
||||||
// set up the LCD's number of columns and rows:
|
// set up the LCD's number of rows and columns:
|
||||||
lcd.begin(10, 2);
|
lcd.begin(16, 2);
|
||||||
// Print a message to the LCD.
|
// Print a message to the LCD.
|
||||||
lcd.print("hI");
|
lcd.print("Hello");
|
||||||
|
|
||||||
}
|
}
|
||||||
void loop() // Main branch, runs over and over again
|
void loop() // Main branch, runs over and over again
|
||||||
{
|
{
|
||||||
// set the cursor to column 0, line 1
|
|
||||||
// (note: line 1 is the second row, since counting begins with 0):
|
|
||||||
lcd.setCursor(0, 1);
|
|
||||||
// print the number of seconds since reset:
|
|
||||||
lcd.print(millis()/1000);
|
|
||||||
|
|
||||||
//////////////////////////
|
//////////////////////////
|
||||||
// Reader input/authentication section
|
// Reader input/authentication section
|
||||||
|
@ -249,31 +242,51 @@ void loop() // Main branch, runs over and ov
|
||||||
long hrsRemaining = (RELAYDELAY - currentTime) / 1000 / 60 / 60;
|
long hrsRemaining = (RELAYDELAY - currentTime) / 1000 / 60 / 60;
|
||||||
|
|
||||||
// display timer & username
|
// display timer & username
|
||||||
Serial.print(hrsRemaining);
|
lcd.setCursor(0, 0);
|
||||||
Serial.print(":");
|
lcd.print(username);
|
||||||
Serial.print(minRemaining);
|
lcd.setCursor(0, 1);
|
||||||
Serial.print(":");
|
lcd.print(hrsRemaining);
|
||||||
Serial.print(secRemaining);
|
lcd.print(":");
|
||||||
Serial.print(" remaining, ");
|
lcd.print(minRemaining);
|
||||||
Serial.println(username);
|
lcd.print(":");
|
||||||
|
lcd.print(secRemaining);
|
||||||
|
lcd.print(" remain");
|
||||||
}
|
}
|
||||||
if(!authorized && relay1high) {
|
if(!authorized && relay1high) {
|
||||||
|
lcd.clear();
|
||||||
|
lcd.setCursor(0, 0);
|
||||||
|
lcd.print("Turning off.");
|
||||||
|
delay(500);
|
||||||
|
lcd.clear();
|
||||||
|
|
||||||
// not authorized -- turn off relay
|
// not authorized -- turn off relay
|
||||||
relayLow(1);
|
relayLow(1);
|
||||||
}
|
}
|
||||||
if(authorized && !relay1high) {
|
if(authorized && !relay1high) {
|
||||||
|
lcd.clear();
|
||||||
|
lcd.setCursor(0, 0);
|
||||||
|
lcd.print("Turning on.");
|
||||||
|
delay(500);
|
||||||
|
lcd.clear();
|
||||||
|
|
||||||
// authorized -- turn on relay
|
// authorized -- turn on relay
|
||||||
relayHigh(1);
|
relayHigh(1);
|
||||||
}
|
}
|
||||||
if(!authorized && !relay1high) {
|
if(!authorized && !relay1high) {
|
||||||
// display login message
|
// display login message
|
||||||
Serial.println("Please login.");
|
lcd.setCursor(0, 0);
|
||||||
|
lcd.print("Please login.");
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End of loop()
|
} // End of loop()
|
||||||
|
|
||||||
|
void lcdprint(int x, int y, char text) {
|
||||||
|
// set the cursor to column 0, line 1
|
||||||
|
// (note: line 1 is the second row, since counting begins with 0):
|
||||||
|
lcd.setCursor(x, y);
|
||||||
|
// print the number of seconds since reset:
|
||||||
|
lcd.print(text);
|
||||||
|
}
|
||||||
|
|
||||||
/* Access System Functions - Modify these as needed for your application.
|
/* Access System Functions - Modify these as needed for your application.
|
||||||
These function control lock/unlock and user lookup.
|
These function control lock/unlock and user lookup.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user