-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprdemo2.ino
executable file
·165 lines (132 loc) · 5.11 KB
/
prdemo2.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
/*********************************************************
* VIZIC TECHNOLOGIES. COPYRIGHT 2013.
* THE DATASHEETS, SOFTWARE AND LIBRARIES ARE PROVIDED "AS IS."
* VIZIC EXPRESSLY DISCLAIM ANY WARRANTY OF ANY KIND, WHETHER
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
* OR NONINFRINGEMENT. IN NO EVENT SHALL VIZIC BE LIABLE FOR
* ANY INCIDENTAL, SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES,
* LOST PROFITS OR LOST DATA, HARM TO YOUR EQUIPMENT, COST OF
* PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR SERVICES,
* ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO
* ANY DEFENCE THEREOF), ANY CLAIMS FOR INDEMNITY OR CONTRIBUTION,
* OR OTHER SIMILAR COSTS.
*********************************************************/
/********************************************************
* IMPORTANT : This Example is created for the Arduino 1.0 Software IDE
********************************************************/
#include <SMARTGPU2.h> //include the SMARTGPU2 library!
SMARTGPU2 lcd; //create our object called LCD
//declare our general coodinates structs
POINT point;
ICON icon;
//Global variables
int hours=11,mins=19,secs=33;
char contactName[7][20]={
"Adam Playford","Akash Krishnani","Alexis Barta","Alice Alcantara","Amanda Bannout","Andrea Jahanbozorg","Anna Kaltenbrunner"};
/////////////////////////////////////////////// RFID VARIABLES
#include <SoftwareSerial.h>
#include <Adafruit_NeoPixel.h>
#include <avr/power.h>
#define RFID_ENABLE 24 //to RFID ENABLE
#define CODE_LEN 10 //Max length of RFID tag
#define VALIDATE_TAG 1 //should we validate tag?
#define VALIDATE_LENGTH 200 //maximum reads b/w tag read and validate
#define ITERATION_LENGTH 2000 //time, in ms, given to the user to move hand away
#define START_BYTE 0x0A
#define STOP_BYTE 0x0D
//#define LED
SoftwareSerial mySerial(A8, A9);
char tag[CODE_LEN];
/**************************************************/
/**************************************************/
//Initial setup
void setup() { //initial setup
//Those two functions must always be called for SMARTGPU support
lcd.init(); //configure the serial and pinout of arduino board for SMARTGPU support
lcd.start(); //initialize the SMARTGPU processor
// RFID SET UP
Serial.begin(2400);
mySerial.begin(2400);
pinMode(RFID_ENABLE, OUTPUT);
// pinMode(LED, OUTPUT);
Serial.println("Test");
}
/**************************************************/
/****************** MAIN LOOP *********************/
/**************************************************/
/**************************************************/
void loop() { //main loop
unsigned char i,n; //icon variable
lcd.baudChange(BAUD7); //set high baud for advanced applications
lcd.orientation(PORTRAIT_LOW); //change to portrait mode
lcd.SDFopenDir("Cellphone"); //Open the Cellphone folder that contains the images of the Application
//Processing Intro
lcd.imageBMPSD(0,20,"Intro"); //load main menu image
for(n=0;n<3;n++){
for(i=0;i<60;i+=20){
lcd.drawCircle(100+i,285,5,YELLOW,FILL);
delay(200);
}
for(i=0;i<60;i+=20){
lcd.drawCircle(100+i,285,5,BLACK,FILL);
delay(200);
}
}
//Main Menu
while(1){ //Forever loop
lcd.orientation(PORTRAIT_LOW);//change to portrait mode
lcd.imageBMPSD(0,0,"Menu"); //load main menu image
clock(1); //Run clock app
if(point.y>270){ //if Y coord is greater than 270
//obtain icon number and begin application based on touch icon number
if(point.x<60){ //if X coordinate is less than 60
keypad();
}
else if(point.x<120){//if X coordinate is less than 120
logs();
}
else if(point.x<180){//if X coordinate is less than 180
apps();
}
else{ //then X coordinate is between 180-239
contacts();
}
}
}
}
void theRFIDthings(){
//Serial.print("HELLO");
enableRFID(); //Enable the RFID card
getRFIDTag(); //Reads the tag
if (isCodeValid()) { //Validates that the tag is good
disableRFID(); //Puts the RFID reader in to low power mode
sendCode(); //Sends the code read to the serial port
delay(ITERATION_LENGTH); //Debounce?
} else {
disableRFID(); //Got a incomplete code..
//digitalWrite(LED, LOW);
Serial.println("Hit me, baby one more time");
}
Serial.flush();
clearCode();
}
boolean RFIDAlt(){
boolean temp2 = false;
//Serial.print("HELLO");
enableRFID(); //Enable the RFID card
getRFIDTag(); //Reads the tag
if (isCodeValid()) { //Validates that the tag is good
disableRFID(); //Puts the RFID reader in to low power mode
sendCode(); //Sends the code read to the serial port
temp2 = true;
delay(ITERATION_LENGTH); //Debounce?
} else {
disableRFID(); //Got a incomplete code..
//digitalWrite(LED, LOW);
Serial.println("Hit me, baby one more time");
}
Serial.flush();
clearCode();
return temp2;
}