Humps
Humps
char hexaKeys[ROWS][COLS] =
{
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = {11, 10, 9, 8}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {7, 6, 5, 4}; //connect to the column pinouts of the keypad
void setup()
{
Serial1.begin(9600); // init serial1 for GSM
lcd.begin(16,2); // init LCD
lcd.print("Sending Data ");
lcd.setCursor(0,1);
lcd.print("to Server");
delay(2000);
lcd.clear();
lcd.print("Circuit Digest");
lcd.setCursor(0,1);
lcd.print("Saddam Khan");
delay(2000);
lcd.clear();
lcd.print("Initializing GSM");
initGSM(); // init GSM module
lcd.clear();
lcd.print("Initializing GPRS");
initGPRS(); // init GPRS in GSM Module
lcd.clear();
lcd.print("System Ready");
delay(2000);
}
void loop()
{
int n=0;
lcd.clear();
lcd.noCursor();
while(1)
{
lcd.cursor();
char key = customKeypad.getKey();
if(key=='1')
getkey(0, 6, key);
if(key=='2')
getkey(7, 10, key);
else if(key=='3')
getkey(11, 14, key);
else if(key=='4')
getkey(15, 18, key);
else if(key=='5')
getkey(19, 22, key);
else if(key=='6')
getkey(23, 26, key);
else if(key=='7')
getkey(27, 31, key);
else if(key=='8')
getkey(32,35, key);
else if(key=='9')
getkey(36, 40, key);
else if(key=='*')
getkey(41, 41, key);
else if(key=='0')
getkey(42, 43, key);
else if(key=='#')
getkey(44, 44, key);
if(pressed)
{
x++;
msg+=alpha[ch-1];
n++;
if(x>15)
{
x=0;
y=1;
}
}
pressed=0;
lcd.blink();
}
void lcd_status()
{
lcd.clear();
lcd.print("Data Sent to");
lcd.setCursor(0,1);
lcd.print("Server");
delay(2000);
lcd.clear();
}
void initGSM()
{
connectGSM("AT","OK");
connectGSM("ATE1","OK");
connectGSM("AT+CPIN?","READY");
}
void initGPRS()
{
connectGSM("AT+CIPSHUT","OK");
connectGSM("AT+CGATT=1","OK");
connectGSM("AT+CSTT=\"airtelgprs.com\",\"\",\"\"","OK");
connectGSM("AT+CIICR","OK");
delay(1000);
Serial1.println("AT+CIFSR");
delay(1000);
}
void connectGSM (String cmd, char *res)
{
while(1)
{
Serial.println(cmd);
Serial1.println(cmd);
delay(500);
while(Serial1.available()>0)
{
if(Serial1.find(res))
{
delay(1000);
return;
}
}
delay(1000);
}
}
/*
Public URL
http://data.sparkfun.com/streams/w5nXxM6rp0tww5YVYg3G
Public Key
w5nXxM6rp0tww5YVYg3G
Private Key
wY9DPG5vzpH99KNrNkx2
Keep this key secret, and in a safe place. You will not be able to retrieve it.
Delete Key
xxxxxxxxxxxxx
This key can only be used once. Keep this key secret, and in a safe place. You will not be able to
retrieve it.
*/