/********************************************************** UZURATTER v2.1 (TWEET FROM ARDUINO MEGA 2560) UZURA-SAN-TEAM @uzurannn -- THIS SKETCH IS IN THE PUBLIC DOMAIN -- /**********************************************************/ #include <SPI.h> #include <Ethernet.h> #include <Twitter.h> byte mac[] = { 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF }; //Your MAC Address byte ip[] = { 192, 168, 0, 117 }; //Your Local IP Address Twitter twitter("Your Token"); #include <LiquidCrystal.h> #include <TimerOne.h> LiquidCrystal lcd(14,15,16,17,18,19,20); byte tilde[8] = { B01000, B10101, B00010, B00000, B00000, B00000, B00000, }; byte cCnt; unsigned char c[101]; volatile int ti; volatile int clrTi; volatile boolean enTiCnt; void setup() { int i; delay(1000); Ethernet.begin(mac, ip); Timer1.initialize(); Timer1.attachInterrupt(timer1_interrupt, 1000); for(i = 22; i < 45; i++) //IO22-IO44 { digitalWrite(i, HIGH); //INTERNAL PULL UP } lcd.createChar(0, tilde); lcd.begin(20, 2); lcd.setCursor(0, 0); lcd.noCursor(); lcd.print("UZURATTER 2.1"); delay(1000); lcd.clear(); lcd.setCursor(0, 1); lcd.print('A'); lcd.setCursor(2, 1); lcd.print('0'); lcd.setCursor(19, 0); lcd.cursor(); } void timer1_interrupt(void) { if(enTiCnt == 1) { if(ti < 1500) { ti++; } } if(clrTi < 2000) { clrTi ++; } } void lcdUpperLine(void) { int i; for(i = 0; i < 20; i++) { lcd.setCursor(i, 0); lcd.print(' '); } if(cCnt <= 19) { lcd.setCursor(19 - cCnt, 0); for(i = 0; i < cCnt; i++) { if(c[i] == '~') { lcd.write(byte(0)); } else { lcd.print((char)c[i]); } } } else { lcd.setCursor(0, 0); for(i = 0; i < 19; i++) { if(c[cCnt - 19 + i] == '~') { lcd.write(byte(0)); } else { lcd.print((char)c[cCnt - 19 + i]); } } } } void keyPushedErr1(int keyPin) { tone(13, 400); delay(80); noTone(13); while(digitalRead(keyPin) == 0){} delay(80); } void keyPushedErr2(int keyPin) { tone(13, 400); delay(80); noTone(13); while(digitalRead(keyPin) == 0){} ti = 0; delay(80); } void loop() { static boolean ovf; static boolean snd; static boolean allCl; static int x; static int y; static int j; static unsigned char ch; static byte key; static byte wheel; static byte cSel; int i; while(1) { //-----key1----- if(digitalRead(22) == 0) { if(ovf == 1) { keyPushedErr1(22); } else { tone(13, 800); delay(80); noTone(13); if(key != 0 && key != 1) { wheel = 0; lcdUpperLine(); j++; lcd.setCursor(19, 0); } else if(key == 1) { wheel++; if(cSel == 0 || cSel == 2) { if(wheel == 5) { wheel = 0; } } else if(cSel == 1) { if(wheel == 2) { wheel = 0; } } } if(cSel == 0) { if(wheel == 0){ch = '@';} else if(wheel == 1){ch = '#';} else if(wheel == 2){ch = '/';} else if(wheel == 3){ch = '&';} else if(wheel == 4){ch = '_';} } else if(cSel == 1) { if(wheel == 0){ch = '1';} else if(wheel == 1){ch = '~';} } else if(cSel == 2) { if(wheel == 0){ch = 177;} else if(wheel == 1){ch = 178;} else if(wheel == 2){ch = 179;} else if(wheel == 3){ch = 180;} else if(wheel == 4){ch = 181;} } cCnt = j + 1; if(cCnt > 100) { ovf = 1; enTiCnt = 0; ti = 0; key = 0; wheel = 0; lcd.cursor(); while(digitalRead(23) == 0){} delay(80); } else { c[j] = ch; lcd.noCursor(); if(ch == '~') { lcd.write(byte(0)); } else { lcd.print((char)ch); } lcd.setCursor(2, 1); lcd.print(cCnt); lcd.setCursor(19, 0); while(digitalRead(22) == 0){} if(enTiCnt == 0) { enTiCnt = 1; } ti = 0; delay(80); key = 1; } } } //-----key2----- if(digitalRead(23) == 0) { if(ovf == 1) { keyPushedErr1(23); } else { tone(13, 800); delay(80); noTone(13); if(key != 0 && key != 2) { wheel = 0; lcdUpperLine(); j++; lcd.setCursor(19, 0); } else if(key == 2) { wheel++; if(cSel == 0 || cSel == 1) { if(wheel == 3) { wheel = 0; } } else if(cSel == 2) { if(wheel == 5) { wheel = 0; } } } if(cSel == 0) { if(wheel == 0){ch = 'a';} else if(wheel == 1){ch = 'b';} else if(wheel == 2){ch = 'c';} } else if(cSel == 1) { if(wheel == 0){ch = '2';} else if(wheel == 1){ch = '\\';} else if(wheel == 2){ch = '$';} } else if(cSel == 2) { if(wheel == 0){ch = 182;} else if(wheel == 1){ch = 183;} else if(wheel == 2){ch = 184;} else if(wheel == 3){ch = 185;} else if(wheel == 4){ch = 186;} } cCnt = j + 1; if(cCnt > 100) { ovf = 1; enTiCnt = 0; ti = 0; key = 0; wheel = 0; lcd.cursor(); while(digitalRead(23) == 0){} delay(80); } else { c[j] = ch; lcd.noCursor(); lcd.print((char)ch); lcd.setCursor(2, 1); lcd.print(cCnt); lcd.setCursor(19, 0); while(digitalRead(23) == 0){} if(enTiCnt == 0) { enTiCnt = 1; } ti = 0; delay(80); key = 2; } } } //-----key3----- if(digitalRead(24) == 0) { if(ovf == 1) { keyPushedErr1(24); } else { tone(13, 800); delay(80); noTone(13); if(key != 0 && key != 3) { wheel = 0; lcdUpperLine(); j++; lcd.setCursor(19, 0); } else if(key == 3) { wheel++; if(cSel == 0 || cSel == 1) { if(wheel == 3) { wheel = 0; } } else if(cSel == 2) { if(wheel == 5) { wheel = 0; } } } if(cSel == 0) { if(wheel == 0){ch = 'd';} else if(wheel == 1){ch = 'e';} else if(wheel == 2){ch = 'f';} } else if(cSel == 1) { if(wheel == 0){ch = '3';} else if(wheel == 1){ch = '%';} else if(wheel == 2){ch = '#';} } else if(cSel == 2) { if(wheel == 0){ch = 187;} else if(wheel == 1){ch = 188;} else if(wheel == 2){ch = 189;} else if(wheel == 3){ch = 190;} else if(wheel == 4){ch = 191;} } cCnt = j + 1; if(cCnt > 100) { ovf = 1; enTiCnt = 0; ti = 0; key = 0; wheel = 0; lcd.cursor(); while(digitalRead(24) == 0){} delay(80); } else { c[j] = ch; lcd.noCursor(); lcd.print((char)ch); lcd.setCursor(2, 1); lcd.print(cCnt); lcd.setCursor(19, 0); while(digitalRead(24) == 0){} if(enTiCnt == 0) { enTiCnt = 1; } ti = 0; delay(80); key = 3; } } } //-----key4----- if(digitalRead(25) == 0) { if(ovf == 1) { keyPushedErr1(25); } else { tone(13, 800); delay(80); noTone(13); if(key != 0 && key != 4) { wheel = 0; lcdUpperLine(); j++; lcd.setCursor(19, 0); } else if(key == 4) { wheel++; if(cSel == 0 || cSel == 1) { if(wheel == 3) { wheel = 0; } } else if(cSel == 2) { if(wheel == 5) { wheel = 0; } } } if(cSel == 0) { if(wheel == 0){ch = 'g';} else if(wheel == 1){ch = 'h';} else if(wheel == 2){ch = 'i';} } else if(cSel == 1) { if(wheel == 0){ch = '4';} else if(wheel == 1){ch = '*';} else if(wheel == 2){ch = '/';} } else if(cSel == 2) { if(wheel == 0){ch = 192;} else if(wheel == 1){ch = 193;} else if(wheel == 2){ch = 194;} else if(wheel == 3){ch = 195;} else if(wheel == 4){ch = 196;} } cCnt = j + 1; if(cCnt > 100) { ovf = 1; enTiCnt = 0; ti = 0; key = 0; wheel = 0; lcd.cursor(); while(digitalRead(25) == 0){} delay(80); } else { c[j] = ch; lcd.noCursor(); lcd.print((char)ch); lcd.setCursor(2, 1); lcd.print(cCnt); lcd.setCursor(19, 0); while(digitalRead(25) == 0){} if(enTiCnt == 0) { enTiCnt = 1; } ti = 0; delay(80); key = 4; } } } //-----key5----- if(digitalRead(26) == 0) { if(ovf == 1) { keyPushedErr1(26); } else { tone(13, 800); delay(80); noTone(13); if(key != 0 && key != 5) { wheel = 0; lcdUpperLine(); j++; lcd.setCursor(19, 0); } else if(key == 5) { wheel++; if(cSel == 0 || cSel == 1) { if(wheel == 3) { wheel = 0; } } else if(cSel == 2) { if(wheel == 5) { wheel = 0; } } } if(cSel == 0) { if(wheel == 0){ch = 'j';} else if(wheel == 1){ch = 'k';} else if(wheel == 2){ch = 'l';} } else if(cSel == 1) { if(wheel == 0){ch = '5';} else if(wheel == 1){ch = '+';} else if(wheel == 2){ch = '-';} } else if(cSel == 2) { if(wheel == 0){ch = 197;} else if(wheel == 1){ch = 198;} else if(wheel == 2){ch = 199;} else if(wheel == 3){ch = 200;} else if(wheel == 4){ch = 201;} } cCnt = j + 1; if(cCnt > 100) { ovf = 1; enTiCnt = 0; ti = 0; key = 0; wheel = 0; lcd.cursor(); while(digitalRead(26) == 0){} delay(80); } else { c[j] = ch; lcd.noCursor(); lcd.print((char)ch); lcd.setCursor(2, 1); lcd.print(cCnt); lcd.setCursor(19, 0); while(digitalRead(26) == 0){} if(enTiCnt == 0) { enTiCnt = 1; } ti = 0; delay(80); key = 5; } } } //-----key6----- if(digitalRead(27) == 0) { if(ovf == 1) { keyPushedErr1(27); } else { tone(13, 800); delay(80); noTone(13); if(key != 0 && key != 6) { wheel = 0; lcdUpperLine(); j++; lcd.setCursor(19, 0); } else if(key == 6) { wheel++; if(cSel == 0) { if(wheel == 3) { wheel = 0; } } else if(cSel == 1) { if(wheel == 4) { wheel = 0; } } else if(cSel == 2) { if(wheel == 5) { wheel = 0; } } } if(cSel == 0) { if(wheel == 0){ch = 'm';} else if(wheel == 1){ch = 'n';} else if(wheel == 2){ch = 'o';} } else if(cSel == 1) { if(wheel == 0){ch = '6';} else if(wheel == 1){ch = '<';} else if(wheel == 2){ch = '=';} else if(wheel == 3){ch = '>';} } else if(cSel == 2) { if(wheel == 0){ch = 202;} else if(wheel == 1){ch = 203;} else if(wheel == 2){ch = 204;} else if(wheel == 3){ch = 205;} else if(wheel == 4){ch = 206;} } cCnt = j + 1; if(cCnt > 100) { ovf = 1; enTiCnt = 0; ti = 0; key = 0; wheel = 0; lcd.cursor(); while(digitalRead(27) == 0){} delay(80); } else { c[j] = ch; lcd.noCursor(); lcd.print((char)ch); lcd.setCursor(2, 1); lcd.print(cCnt); lcd.setCursor(19, 0); while(digitalRead(27) == 0){} if(enTiCnt == 0) { enTiCnt = 1; } ti = 0; delay(80); key = 6; } } } //-----key7----- if(digitalRead(28) == 0) { if(ovf == 1) { keyPushedErr1(28); } else { tone(13, 800); delay(80); noTone(13); if(key != 0 && key != 7) { wheel = 0; lcdUpperLine(); j++; lcd.setCursor(19, 0); } else if(key == 7) { wheel++; if(cSel == 0) { if(wheel == 4) { wheel = 0; } } else if(cSel == 1) { if(wheel == 3) { wheel = 0; } } else if(cSel == 2) { if(wheel == 5) { wheel = 0; } } } if(cSel == 0) { if(wheel == 0){ch = 'p';} else if(wheel == 1){ch = 'q';} else if(wheel == 2){ch = 'r';} else if(wheel == 3){ch = 's';} } else if(cSel == 1) { if(wheel == 0){ch = '7';} else if(wheel == 1){ch = 162;} else if(wheel == 2){ch = 163;} } else if(cSel == 2) { if(wheel == 0){ch = 207;} else if(wheel == 1){ch = 208;} else if(wheel == 2){ch = 209;} else if(wheel == 3){ch = 210;} else if(wheel == 4){ch = 211;} } cCnt = j + 1; if(cCnt > 100) { ovf = 1; enTiCnt = 0; ti = 0; key = 0; wheel = 0; lcd.cursor(); while(digitalRead(28) == 0){} delay(80); } else { c[j] = ch; lcd.noCursor(); lcd.print((char)ch); lcd.setCursor(2, 1); lcd.print(cCnt); lcd.setCursor(19, 0); while(digitalRead(28) == 0){} if(enTiCnt == 0) { enTiCnt = 1; } ti = 0; delay(80); key = 7; } } } //-----key8----- if(digitalRead(29) == 0) { if(ovf == 1) { keyPushedErr1(29); } else { tone(13, 800); delay(80); noTone(13); if(key != 0 && key != 8) { wheel = 0; lcdUpperLine(); j++; lcd.setCursor(19, 0); } else if(key == 8) { wheel++; if(wheel == 3) { wheel = 0; } } if(cSel == 0) { if(wheel == 0){ch = 't';} else if(wheel == 1){ch = 'u';} else if(wheel == 2){ch = 'v';} } else if(cSel == 1) { if(wheel == 0){ch = '8';} else if(wheel == 1){ch = '&';} else if(wheel == 2){ch = '@';} } else if(cSel == 2) { if(wheel == 0){ch = 212;} else if(wheel == 1){ch = 213;} else if(wheel == 2){ch = 214;} } cCnt = j + 1; if(cCnt > 100) { ovf = 1; enTiCnt = 0; ti = 0; key = 0; wheel = 0; lcd.cursor(); while(digitalRead(29) == 0){} delay(80); } else { c[j] = ch; lcd.noCursor(); lcd.print((char)ch); lcd.setCursor(2, 1); lcd.print(cCnt); lcd.setCursor(19, 0); while(digitalRead(29) == 0){} if(enTiCnt == 0) { enTiCnt = 1; } ti = 0; delay(80); key = 8; } } } //-----key9----- if(digitalRead(30) == 0) { if(ovf == 1) { keyPushedErr1(30); } else { tone(13, 800); delay(80); noTone(13); if(key != 0 && key != 9) { wheel = 0; lcdUpperLine(); j++; lcd.setCursor(19, 0); } else if(key == 9) { wheel++; if(cSel == 0 || cSel == 1) { if(wheel == 4) { wheel = 0; } } else if(cSel == 2) { if(wheel == 5) { wheel = 0; } } } if(cSel == 0) { if(wheel == 0){ch = 'w';} else if(wheel == 1){ch = 'x';} else if(wheel == 2){ch = 'y';} else if(wheel == 3){ch = 'z';} } else if(cSel == 1) { if(wheel == 0){ch = '9';} else if(wheel == 1){ch = '^';} else if(wheel == 2){ch = '|';} else if(wheel == 3){ch = '`';} } else if(cSel == 2) { if(wheel == 0){ch = 215;} else if(wheel == 1){ch = 216;} else if(wheel == 2){ch = 217;} else if(wheel == 3){ch = 218;} else if(wheel == 4){ch = 219;} } cCnt = j + 1; if(cCnt > 100) { ovf = 1; enTiCnt = 0; ti = 0; key = 0; wheel = 0; lcd.cursor(); while(digitalRead(30) == 0){} delay(80); } else { c[j] = ch; lcd.noCursor(); lcd.print((char)ch); lcd.setCursor(2, 1); lcd.print(cCnt); lcd.setCursor(19, 0); while(digitalRead(30) == 0){} if(enTiCnt == 0) { enTiCnt = 1; } ti = 0; delay(80); key = 9; } } } //-----key10(Blue1)----- if(digitalRead(31) == 0) { if(cSel == 0) { if(ovf == 1) { keyPushedErr1(31); } else { if(key == 0) { keyPushedErr2(31); } else { if(ch >= 97 && ch <= 122) { tone(13, 800); delay(80); noTone(13); ch = ch - 32; c[j] = ch; lcd.print((char)ch); lcd.setCursor(19, 0); while(digitalRead(31) == 0){} ti = 0; delay(80); } else if(ch >= 65 && ch <= 90) { tone(13, 800); delay(80); noTone(13); ch = ch + 32; c[j] = ch; lcd.print((char)ch); lcd.setCursor(19, 0); while(digitalRead(31) == 0){} ti = 0; delay(80); } else { keyPushedErr2(31); } } } } else if(cSel == 1) { if(ovf == 1) { keyPushedErr1(31); } else { tone(13, 800); delay(80); noTone(13); if(key != 0 && key != 10) { wheel = 0; lcdUpperLine(); j++; lcd.setCursor(19, 0); } else if(key == 10) { wheel++; if(wheel == 4) { wheel = 0; } } if(wheel == 0){ch = '(';} else if(wheel == 1){ch = ')';} else if(wheel == 2){ch = '[';} else if(wheel == 3){ch = ']';} cCnt = j + 1; if(cCnt > 100) { ovf = 1; enTiCnt = 0; ti = 0; key = 0; wheel = 0; lcd.cursor(); while(digitalRead(31) == 0){} delay(80); } else { c[j] = ch; lcd.noCursor(); lcd.print((char)ch); lcd.setCursor(2, 1); lcd.print(cCnt); lcd.setCursor(19, 0); while(digitalRead(31) == 0){} if(enTiCnt == 0) { enTiCnt = 1; } ti = 0; delay(80); key = 10; } } } else if(cSel == 2) { if(ovf == 1) { keyPushedErr1(31); } else { if(key == 0) { keyPushedErr2(31); } else { if(ch >= 177 && ch <= 181) { tone(13, 800); delay(80); noTone(13); ch = ch - 10; c[j] = ch; lcd.print((char)ch); lcd.setCursor(19, 0); while(digitalRead(31) == 0){} ti = 0; delay(80); } else if(ch >= 167 && ch <= 171) { tone(13, 800); delay(80); noTone(13); ch = ch + 10; c[j] = ch; lcd.print((char)ch); lcd.setCursor(19, 0); while(digitalRead(31) == 0){} ti = 0; delay(80); } else if(ch == 194) { tone(13, 800); delay(80); noTone(13); ch = 175; c[j] = ch; lcd.print((char)ch); lcd.setCursor(19, 0); while(digitalRead(31) == 0){} ti = 0; delay(80); } else if(ch == 175) { tone(13, 800); delay(80); noTone(13); ch = 194; c[j] = ch; lcd.print((char)ch); lcd.setCursor(19, 0); while(digitalRead(31) == 0){} ti = 0; delay(80); } else if(ch >= 212 && ch <= 214) { tone(13, 800); delay(80); noTone(13); ch = ch - 40; c[j] = ch; lcd.print((char)ch); lcd.setCursor(19, 0); while(digitalRead(31) == 0){} ti = 0; delay(80); } else if(ch >= 172 && ch <= 174) { tone(13, 800); delay(80); noTone(13); ch = ch + 40; c[j] = ch; lcd.print((char)ch); lcd.setCursor(19, 0); while(digitalRead(31) == 0){} ti = 0; delay(80); } else { keyPushedErr2(31); } } } } } //-----key11----- if(digitalRead(32) == 0) { if(ovf == 1) { keyPushedErr1(32); } else { tone(13, 800); delay(80); noTone(13); if(key != 0 && key !=11) { wheel = 0; lcdUpperLine(); j++; lcd.setCursor(19, 0); } else if(key == 11) { wheel++; if(cSel == 0) { if(wheel == 4) { wheel = 0; } } else if(cSel == 1) { if(wheel == 5) { wheel = 0; } } else if(cSel == 2) { if(wheel == 6) { wheel = 0; } } } if(cSel == 0) { if(wheel == 0){ch = ':';} else if(wheel == 1){ch = ';';} else if(wheel == 2){ch = '\'';} else if(wheel == 3){ch = '"';} } else if(cSel == 1) { if(wheel == 0){ch = '0';} else if(wheel == 1){ch = ':';} else if(wheel == 2){ch = ';';} else if(wheel == 3){ch = '\'';} else if(wheel == 4){ch = '"';} } else if(cSel == 2) { if(wheel == 0){ch = 220;} else if(wheel == 1){ch = 166;} else if(wheel == 2){ch = 221;} else if(wheel == 3){ch = 176;} else if(wheel == 4){ch = 162;} else if(wheel == 5){ch = 163;} } cCnt = j + 1; if(cCnt > 100) { ovf = 1; enTiCnt = 0; ti = 0; key = 0; wheel = 0; lcd.cursor(); while(digitalRead(32) == 0){} delay(80); } else { c[j] = ch; lcd.noCursor(); lcd.print((char)ch); lcd.setCursor(2, 1); lcd.print(cCnt); lcd.setCursor(19, 0); while(digitalRead(32) == 0){} if(enTiCnt == 0) { enTiCnt = 1; } ti = 0; delay(80); key = 11; } } } //-----key12----- if(digitalRead(33) == 0) { if(ovf == 1) { keyPushedErr1(33); } else { tone(13, 800); delay(80); noTone(13); if(key != 0 && key !=12) { wheel = 0; lcdUpperLine(); j++; lcd.setCursor(19, 0); } else if(key == 12) { wheel++; if(cSel == 0 || cSel == 1) { if(wheel == 4) { wheel = 0; } } else if(cSel == 2) { if(wheel == 6) { wheel = 0; } } } if(cSel == 0) { if(wheel == 0){ch = '.';} else if(wheel == 1){ch = ',';} else if(wheel == 2){ch = '?';} else if(wheel == 3){ch = '!';} } else if(cSel == 1) { if(wheel == 0){ch = '.';} else if(wheel == 1){ch = ',';} else if(wheel == 2){ch = '?';} else if(wheel == 3){ch = '!';} } else if(cSel == 2) { if(wheel == 0){ch = 222;} else if(wheel == 1){ch = 223;} else if(wheel == 2){ch = 164;} else if(wheel == 3){ch = 161;} else if(wheel == 4){ch = '?';} else if(wheel == 5){ch = '!';} } cCnt = j + 1; if(cCnt > 100) { ovf = 1; enTiCnt = 0; ti = 0; key = 0; wheel = 0; lcd.cursor(); while(digitalRead(33) == 0){} delay(80); } else { c[j] = ch; lcd.noCursor(); lcd.print((char)ch); lcd.setCursor(2, 1); lcd.print(cCnt); lcd.setCursor(19, 0); while(digitalRead(33) == 0){} if(enTiCnt == 0) { enTiCnt = 1; } ti = 0; delay(80); key = 12; } } } //-----keyGreen----- if(digitalRead(40) == 0) { if(ovf == 1) { keyPushedErr1(40); } else { if(key == 0) { keyPushedErr1(40); } else { tone(13, 800); delay(80); noTone(13); enTiCnt = 0; ti = 0; key = 0; wheel = 0; lcdUpperLine(); j++; cCnt = j + 1; if(cCnt > 100) { ovf = 1; } lcd.setCursor(19, 0); lcd.cursor(); while(digitalRead(40) == 0){} delay(80); } } } //-----keyRed----- if(digitalRead(41) == 0) { if(cCnt == 0) { tone(13, 400); delay(80); noTone(13); clrTi = 0; while(digitalRead(41) == 0) { if(clrTi > 1300) { allCl = 1; goto LABEL1; } } delay(80); } else { tone(13, 800); delay(80); noTone(13); if(key == 0) { j--; cCnt = j; c[j] = '\0'; if(ovf == 1) { ovf = 0; } lcd.noCursor(); lcdUpperLine(); } else { lcd.print(' '); c[j] = '\0'; cCnt--; enTiCnt = 0; ti = 0; key = 0; wheel = 0; } lcd.setCursor(2, 1); lcd.print(" "); lcd.setCursor(2, 1); lcd.print(cCnt); lcd.setCursor(19, 0); lcd.cursor(); clrTi = 0; while(digitalRead(41) == 0) { if(clrTi > 1300) { allCl = 1; goto LABEL1; } } delay(80); } } //-----keyWhite----- if(digitalRead(42) == 0) { if(ovf == 1) { keyPushedErr1(42); } else { tone(13, 800); delay(80); noTone(13); if(key > 0) { lcdUpperLine(); j++; lcd.setCursor(19, 0); } ch = ' '; cCnt = j + 1; if(cCnt > 100) { c[j] = ch; ovf = 1; enTiCnt = 0; ti = 0; key = 0; wheel = 0; lcd.cursor(); while(digitalRead(23) == 0){} delay(80); } else { c[j] = ch; lcd.noCursor(); lcd.print((char)ch); lcd.setCursor(2, 1); lcd.print(cCnt); lcdUpperLine(); j++; cCnt = j + 1; if(cCnt > 100) { ovf = 1; } enTiCnt = 0; ti = 0; key = 0; wheel = 0; lcd.setCursor(19, 0); lcd.cursor(); while(digitalRead(42) == 0){} delay(80); } } } //-----keyOrange----- if(digitalRead(43) == 0) { if(ovf == 1) { keyPushedErr1(43); } else { tone(13, 800); delay(80); noTone(13); if(key > 0) { enTiCnt = 0; ti = 0; key = 0; wheel = 0; lcdUpperLine(); j++; cCnt = j + 1; if(cCnt > 100) { ovf = 1; } } cSel++; if(cSel == 3) { cSel = 0; } lcd.noCursor(); lcd.setCursor(0, 1); if(cSel == 0) { lcd.print('A'); } else if(cSel == 1) { lcd.print('N'); } else if(cSel == 2) { lcd.print('K'); } lcd.setCursor(19, 0); lcd.cursor(); while(digitalRead(43) == 0){} delay(80); } } //-----timeOut----- if(ti > 1000) { enTiCnt = 0; ti = 0; key = 0; wheel = 0; lcdUpperLine(); j++; cCnt = j + 1; if(cCnt > 100) { ovf = 1; } lcd.setCursor(19, 0); lcd.cursor(); } //-----keyTweet----- if(digitalRead(44) == 0) { tone(13, 400); delay(80); tone(13, 800); delay(80); noTone(13); while(digitalRead(44) == 0){} delay(80); snd = 1; goto LABEL1; } } LABEL1: if(allCl == 1) { lcd.noCursor(); lcd.clear(); lcd.setCursor(0, 1); lcd.print('A'); lcd.setCursor(2, 1); lcd.print('0'); tone(13, 800); delay(1000); noTone(13); for(i = 0; i < 100; i++) { c[i] = '\0'; } j = 0; cCnt = 0; ovf = 0; enTiCnt = 0; ti = 0; key = 0; wheel = 0; cSel = 0; allCl = 0; while(digitalRead(41) == 0){} lcd.setCursor(19, 0); lcd.cursor(); } else if(snd == 1) { unsigned char sBuf[301]; for(i = 0; i < 300; i++) { sBuf[i] = '\0'; } i = 0; j = 0; while(c[j] != '\0') { if(c[j] >= 21 && c[j] <= 126) { sBuf[i] = c[j]; i++; j++; } else if(c[j] >= 161 && c[j] <= 191) //CONVERT TO UTF8 { sBuf[i] = 0xEF; i++; sBuf[i] = 0xBD; i++; sBuf[i] = c[j]; i++; j++; } else if(c[j] >= 192 && c[j] <= 223) //CONVERT TO UTF8 { sBuf[i] = 0xEF; i++; sBuf[i] = 0xBE; i++; sBuf[i] = c[j]; sBuf[i] = sBuf[i] - 0x40; i++; j++; } else { j++; } } lcd.noCursor(); for(i = 6; i < 20; i++) { lcd.setCursor(i, 1); lcd.print(' '); } lcd.setCursor(6, 1); lcd.print("CONNECT"); delay(1000); if (twitter.post((char*)sBuf)) { int status = twitter.wait(); if (status == 200) { for(i = 6; i < 20; i++) { lcd.setCursor(i, 1); lcd.print(' '); } lcd.setCursor(6, 1); lcd.print("TWEET OK"); delay(1000); lcd.clear(); lcd.setCursor(0, 1); lcd.print('A'); lcd.setCursor(2, 1); lcd.print('0'); for(i = 0; i < 100; i++) { c[i] = '\0'; } j = 0; cCnt = 0; ovf = 0; enTiCnt = 0; ti = 0; key = 0; wheel = 0; cSel = 0; } else { for(i = 6; i < 20; i++) { lcd.setCursor(i, 1); lcd.print(' '); } lcd.setCursor(6, 1); lcd.print("ERROR: "); lcd.print(status); delay(1000); for(i = 6; i < 20; i++) { lcd.setCursor(i, 1); lcd.print(' '); } } } else { for(i = 6; i < 20; i++) { lcd.setCursor(i, 1); lcd.print(' '); } lcd.setCursor(6, 1); lcd.print("CONNECT ERROR"); delay(1000); for(i = 6; i < 20; i++) { lcd.setCursor(i, 1); lcd.print(' '); } } snd = 0; lcd.setCursor(19, 0); lcd.cursor(); } }