2 /* Lettura di un canale servo della RX
4 Lettura tramite uno dei due external interrupt ala Arduino
5 Utilizzabile solo sui PIN 2-3
12 // Variabili per interrupt 0
13 volatile unsigned int chValue = 1500; // Valore computato
14 volatile unsigned int chStart = 1500; // Inizio rilevamento
16 // Variabili per autocalibrazione
17 const byte chPin = 2; // PIN per la calibrazione
21 // Funzione relativa a calibrazione con pulsein:
22 // mid_point = calibraTrim(chPin) ; // Calibrazione del TRIM attivo sul canale
23 attachInterrupt(0, chRise, RISING); // PIN 2 su 328p / 168
25 Serial.begin(9600); // Warning: interrupts e serial potrebbero dare problemi
31 Serial.print(chValue);
32 Serial.print(" - base: ");
33 Serial.println(mid_point);
40 attachInterrupt(0, chFall, FALLING);
45 attachInterrupt(0, chRise, RISING);
46 chValue = micros() - chStart;