|
752
|
Using Arduino / Programming Questions / Re: programming help
|
on: February 07, 2013, 08:29:29 am
|
|
There are PLENTY of RTC code in either here or project guidence, that do something after a certain time has passed. Most, if not ALL have examples. Find them, read them, learn from them, and write your own. Come back when you have an actual code that compiles or at least has some errors that make sense based on what you wrote.
No code, no help.
|
|
|
|
|
756
|
Using Arduino / Programming Questions / Re: Button change
|
on: February 06, 2013, 08:03:42 pm
|
boolean latch = false; unsigned long timer = 0; byte LED_pin = 13;
void setup() { . . . }
void loop() {
//debounce code here
if(button == HIGH) { latch = !latch; timer = millis();
if(latch == true && (millis() - timer < 3000) { digitalWrite(LED_pin, HIGH); }
else { digitalWrite(LED_pin, LOW); } } }
untested but if you fill in the rest, it should work.
|
|
|
|
|
764
|
Using Arduino / Programming Questions / Re: TFT keypad need help on coding
|
on: February 06, 2013, 11:49:44 am
|
You said you already made a map of the buttons. if (page == 70 && p.y > 211 && p.y < 231 && p.x > 84 && p.x <104 ){ // im guessing button ZERO tft.setTextSize(3); tft.fillRect(82, 201, 25, 25, BLUE); tft.setCursor(82, 201); tft.println ("0"); myInts[counter++] = '0'; // *** this is the setup needed *** the numbers must go between single quotes ' ' // Everytime you press a button, counter updates and the char is stored // If special button is pressed, convert data in array. } else if (page == 70 && p.y > 290 && p.y < 310 && p.x > 190 && p.x <215 && q==1){ // Button ONE tft.setTextSize(3); tft.fillRect(110, 201, 25, 25, BLUE); tft.setCursor(110, 201); tft.println ("1"); myInts[counter++] = '1'; } . TWO . THREE . FOUR And so on
Added: You also need to make sure you set the counter back to zero after you convert the array to an int.
|
|
|
|
|