@vojinilic
Da li si mislio na nešto ovako?
Da li si mislio na nešto ovako?
Code:
int taster = 10; //taster
int tastertest; //promjenljiva za taster
void setup()
{
pinMode(taster, INPUT);
// initialize Timer1
noInterrupts(); // disable all interrupts
TCCR1A = 0;
TCCR1B = 0;
TCNT1 = 62437;
TCCR1B |= (0 << CS10 ) | (0 << CS11) | (1 << CS12); //256
TIMSK1 |= (1 << TOIE1); // enable timer overflow interrupt
interrupts(); // enable all interrupts
}
ISR(Timer1_OVF_vect) // interrupt service routine that wraps a user defined function supplied by attachInterrupt
{
TCNT1 = 62437; // preload timer
if(digitalRead(10) = HIGH){
tastertest++
if(tasterttest > 3){
//poruka koja se šalje kao komanda
}
}
if(digitalRead(10) == LOW){
tastertest = 0;
}
}
void loop()
{
}