Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Arduino - Remote control (RF-TX)
Tvoj interapt :
Code:
ISR(TIMER1_OVF_vect) // interrupt service routine that wraps a user defined function supplied by attachInterrupt
  {
     TCNT1 = 62437; // preload timer
     if(digitalRead(8) == HIGH){
      //digitalWrite(LED, HIGH);
      taster1test++;
      if(taster1test > 3){
       mySerial.println(1111); //poruka koja se šalje kao komanda
      }
     }
     else{
      taster1test = 0;
      mySerial.println(0000);
     }

     if(digitalRead(9) == HIGH){
      //digitalWrite(LED, HIGH);
      taster2test++;
      if(taster2test > 3){
       mySerial.println(2222); //poruka koja se šalje kao komanda
      }
     }
     else{
      taster2test = 0;
      mySerial.println(3333);
     }

  }

void loop() {

}
A taj interapt koji si dao u nekim od gornjih postova je dobro setovan ali koliko vidim onako na brzaka nisi ga dobro ispostovao jer ti ne zaustavljas interapte dok se ne izvrsi postojeci koji se vec desio. Sto znaci dok tvoj kod ispita tastere i pocme da salje komandu desi se novi interapt i onda Jovo nanovo. A koliko vidim ti u u toj ISR rutini radis proveru da li je taster pritisnut i onda radis debounce  (proveravas da li je digitalRead == HIGH i to tri puta zaredom) i jos saljes podatke serijskom komunikacijom.

U toj ISR trebo bi samo da ispitas dali je neki od tastera pritisnut i po meni onda ti mozda i ne treba debounce jel ako je ISR rutina "uhvatila" da je negde na digitalRead HIGH onda ne moram da proveravam da li je to "cvrsto" HIGH (debounce) jednostavno neko je "pipnuo" taster i ide komanda...

Jedino ako imas "drzanje" tastera radi continuiteta slanja komandi onda mora debounce...

Evo za ovaj tvoj interupt uradi ovako :
Code:
ISR(TIMER1_OVF_vect) // interrupt service routine that wraps a user defined function supplied by attachInterrupt
   {
    
noInterrupts(); // disable all interrupts

      TCNT1 = 62437; // preload timer
      if(digitalRead(8) == HIGH){
       //digitalWrite(LED, HIGH);
       taster1test++;
       if(taster1test > 3){
        mySerial.println(1111); //poruka koja se šalje kao komanda
       }
      }
      else{
       taster1test = 0;
       mySerial.println(0000);
      }

      if(digitalRead(9) == HIGH){
       //digitalWrite(LED, HIGH);
       taster2test++;
       if(taster2test > 3){
        mySerial.println(2222); //poruka koja se šalje kao komanda
       }
      }
      else{
       taster2test = 0;
       mySerial.println(3333);
      }

interrupts(); // enable all interrupts

   }

void loop() {

}
Reply


Messages In This Thread
Arduino - Remote control (RF-TX) - by Makso - 09-10-2016, 01:02 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 09-10-2016, 04:03 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 09-10-2016, 06:20 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 09-11-2016, 05:43 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 09-11-2016, 06:40 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 09-11-2016, 07:00 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 09-11-2016, 07:07 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 09-11-2016, 07:28 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 09-11-2016, 07:33 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 09-11-2016, 07:46 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 09-11-2016, 08:09 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 09-26-2016, 03:11 PM
RE: Arduino - Remote control (RF-TX) - by Omegakg - 09-26-2016, 04:52 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 09-26-2016, 06:31 PM
RE: Arduino - Remote control (RF-TX) - by Omegakg - 09-26-2016, 06:57 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 09-26-2016, 07:14 PM
RE: Arduino - Remote control (RF-TX) - by Omegakg - 09-26-2016, 08:54 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 09-26-2016, 10:01 PM
RE: Arduino - Remote control (RF-TX) - by Omegakg - 09-27-2016, 10:38 AM
RE: Arduino - Remote control (RF-TX) - by Makso - 09-27-2016, 12:40 PM
RE: Arduino - Remote control (RF-TX) - by me[R]a - 09-27-2016, 03:40 PM
RE: Arduino - Remote control (RF-TX) - by gorankg - 09-27-2016, 04:37 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 09-27-2016, 05:32 PM
RE: Arduino - Remote control (RF-TX) - by me[R]a - 09-27-2016, 07:58 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 09-27-2016, 08:07 PM
RE: Arduino - Remote control (RF-TX) - by npejcic - 09-27-2016, 09:09 PM
RE: Arduino - Remote control (RF-TX) - by Omegakg - 09-27-2016, 10:33 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 09-27-2016, 10:44 PM
RE: Arduino - Remote control (RF-TX) - by npejcic - 09-28-2016, 08:48 AM
RE: Arduino - Remote control (RF-TX) - by Makso - 09-28-2016, 11:45 AM
RE: Arduino - Remote control (RF-TX) - by npejcic - 09-28-2016, 06:33 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 09-28-2016, 06:48 PM
RE: Arduino - Remote control (RF-TX) - by npejcic - 09-28-2016, 07:11 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 09-28-2016, 07:19 PM
RE: Arduino - Remote control (RF-TX) - by npejcic - 09-29-2016, 09:32 AM
RE: Arduino - Remote control (RF-TX) - by Makso - 10-03-2016, 10:46 PM
RE: Arduino - Remote control (RF-TX) - by me[R]a - 10-06-2016, 09:32 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 10-06-2016, 10:20 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 10-20-2016, 10:59 AM
RE: Arduino - Remote control (RF-TX) - by npejcic - 10-20-2016, 04:10 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 10-20-2016, 06:17 PM
RE: Arduino - Remote control (RF-TX) - by npejcic - 10-20-2016, 08:16 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 02-18-2017, 03:28 PM
RE: Arduino - Remote control (RF-TX) - by gorankg - 02-18-2017, 07:28 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 02-18-2017, 08:04 PM
RE: Arduino - Remote control (RF-TX) - by gorankg - 02-19-2017, 01:20 PM
RE: Arduino - Remote control (RF-TX) - by gorankg - 02-18-2017, 09:29 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 02-18-2017, 11:24 PM
RE: Arduino - Remote control (RF-TX) - by gorankg - 02-19-2017, 09:25 AM
RE: Arduino - Remote control (RF-TX) - by Makso - 02-19-2017, 12:08 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 02-19-2017, 07:31 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 02-27-2017, 04:31 PM
RE: Arduino - Remote control (RF-TX) - by vsavic - 02-27-2017, 04:43 PM
RE: Arduino - Remote control (RF-TX) - by gorankg - 02-27-2017, 04:56 PM
RE: Arduino - Remote control (RF-TX) - by me[R]a - 02-27-2017, 07:34 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 02-27-2017, 10:56 PM
RE: Arduino - Remote control (RF-TX) - by me[R]a - 02-28-2017, 01:59 AM
RE: Arduino - Remote control (RF-TX) - by Makso - 02-28-2017, 09:17 AM
RE: Arduino - Remote control (RF-TX) - by Makso - 03-26-2017, 11:41 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 09-15-2017, 11:16 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 12-28-2017, 10:37 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 12-29-2017, 12:29 AM
RE: Arduino - Remote control (RF-TX) - by Makso - 12-29-2017, 01:05 AM
RE: Arduino - Remote control (RF-TX) - by Makso - 01-03-2018, 12:40 AM
RE: Arduino - Remote control (RF-TX) - by mikikg - 01-03-2018, 08:28 AM
RE: Arduino - Remote control (RF-TX) - by Makso - 01-05-2018, 05:49 PM
RE: Arduino - Remote control (RF-TX) - by me[R]a - 01-05-2018, 11:38 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 01-06-2018, 12:06 AM
RE: Arduino - Remote control (RF-TX) - by me[R]a - 01-06-2018, 12:12 AM
RE: Arduino - Remote control (RF-TX) - by Makso - 01-06-2018, 12:33 AM
RE: Arduino - Remote control (RF-TX) - by gorankg - 01-06-2018, 08:45 AM
RE: Arduino - Remote control (RF-TX) - by Makso - 01-06-2018, 08:34 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 01-17-2018, 08:28 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 01-18-2018, 06:05 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 01-19-2018, 06:38 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 01-19-2018, 11:19 PM
RE: Arduino - Remote control (RF-TX) - by me[R]a - 01-21-2018, 03:28 AM
RE: Arduino - Remote control (RF-TX) - by Makso - 01-21-2018, 01:26 PM
RE: Arduino - Remote control (RF-TX) - by me[R]a - 01-21-2018, 05:28 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 01-22-2018, 01:12 AM
RE: Arduino - Remote control (RF-TX) - by Makso - 01-22-2018, 01:40 AM
RE: Arduino - Remote control (RF-TX) - by me[R]a - 01-22-2018, 01:54 AM
RE: Arduino - Remote control (RF-TX) - by Makso - 01-22-2018, 02:03 AM
RE: Arduino - Remote control (RF-TX) - by me[R]a - 01-22-2018, 10:33 AM
RE: Arduino - Remote control (RF-TX) - by Makso - 01-22-2018, 01:51 PM
RE: Arduino - Remote control (RF-TX) - by me[R]a - 01-22-2018, 03:19 PM
RE: Arduino - Remote control (RF-TX) - by me[R]a - 01-22-2018, 03:50 PM
RE: Arduino - Remote control (RF-TX) - by gorankg - 01-22-2018, 04:00 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 01-22-2018, 09:12 PM
RE: Arduino - Remote control (RF-TX) - by me[R]a - 01-22-2018, 10:48 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 01-22-2018, 11:12 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 01-23-2018, 01:22 AM
RE: Arduino - Remote control (RF-TX) - by Makso - 01-23-2018, 01:20 PM
RE: Arduino - Remote control (RF-TX) - by me[R]a - 01-23-2018, 03:18 PM
RE: Arduino - Remote control (RF-TX) - by me[R]a - 01-23-2018, 07:20 PM
RE: Arduino - Remote control (RF-TX) - by gorankg - 01-23-2018, 07:26 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 01-23-2018, 03:53 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 01-23-2018, 10:21 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 01-23-2018, 11:47 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 01-24-2018, 04:12 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 01-24-2018, 04:46 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 01-24-2018, 05:20 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 01-24-2018, 05:52 PM
RE: Arduino - Remote control (RF-TX) - by gorankg - 01-24-2018, 06:30 PM
RE: Arduino - Remote control (RF-TX) - by me[R]a - 01-24-2018, 09:37 PM
RE: Arduino - Remote control (RF-TX) - by me[R]a - 01-25-2018, 02:01 AM
RE: Arduino - Remote control (RF-TX) - by Makso - 01-25-2018, 01:54 PM
RE: Arduino - Remote control (RF-TX) - by me[R]a - 01-25-2018, 02:35 PM
RE: Arduino - Remote control (RF-TX) - by me[R]a - 01-26-2018, 12:34 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 01-26-2018, 12:57 PM
RE: Arduino - Remote control (RF-TX) - by me[R]a - 01-26-2018, 04:05 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 01-26-2018, 09:08 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 01-31-2018, 09:02 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 01-31-2018, 09:39 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 01-31-2018, 10:14 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 02-02-2018, 06:27 PM
RE: Arduino - Remote control (RF-TX) - by gorankg - 02-02-2018, 09:35 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 02-02-2018, 11:33 PM
RE: Arduino - Remote control (RF-TX) - by mikikg - 02-03-2018, 10:14 AM
RE: Arduino - Remote control (RF-TX) - by Makso - 02-03-2018, 02:13 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 02-03-2018, 08:59 PM
RE: Arduino - Remote control (RF-TX) - by Makso - 05-26-2018, 12:03 PM

Forum Jump:


Users browsing this thread: 19 Guest(s)