3 Sketch da breadboard, il throttle e' simulato con un potenziometro.
8 enum { // Stati della FMS
9 idle, // Throttle a zero
14 // Due LED con lampeggio alternato:
15 Lampeggiatore right = 13;
19 const byte thrPin = A3;
28 randomSeed(analogRead(0));
33 // Utilizzando un potenziometro
34 // thrIn = analogRead(3);
35 // thr = constrain(thrIn / 4 , 0, 255) ;
38 thrIn = pulseIn(thrPin, HIGH, 25000);
39 // Hint: thrIn andrebbe calibrato son un Serial.write
40 thr = constrain(map(thrIn, 960, 2000, 0, 255), 0, 255);
45 } else if ( thr > 245 ) {
58 // Due LED con lampeggio alternato:
59 right.Blink(1120 - 4 * thr );
64 digitalWrite(3, HIGH);
76 Serial.print("\t thr:");
78 Serial.print("\t state:");
79 Serial.println(state);