*/
#include <common.h>
-#define dEBUG
+#define DEBUG
// LED disponibili
Lampeggiatore left = 7;
Pwm motore = 3;
// RGB
-RGBLed ailerons(6,5,9);
+RGBLed ailerons(6,5,9,255);
// Transizione: lampeggiatori sui PIN RGB
Lampeggiatore sxLamp(5); // Lampeggiatore
Lampeggiatore dxLamp(9); // Lampeggiatore
// Var thr
//////////////// !!!! cambiare thrIn
-const byte thrPin = A5; // PIN collegato al CH3
+const byte thrPin = A2; // PIN collegato al CH3
byte thr ; // Throttle a 8bit
int thrIn ; // Valore del th in ingresso dal servo
volatile unsigned int ail = 1500; // Valore computato
volatile unsigned int chStart2 = 1500; // Inizio rilevamento
-// Variabili per autocalibrazione 0
-const byte chPin2 = 2; // PIN per la calibrazione
-int mid_point2 = 1500;
// Vars Alettoni
-int mid_point = 1560 ; // centro del segnale, trimmato nel setup
-const int deviation = 50 ; // deviazione dal punto medio
+const byte chPin2 = 2; // PIN per la calibrazione
+int mid_point = 1450 ; // centro del segnale, trimmato nel setup
+const int deviation = 40 ; // deviazione dal punto medio
//per entrare nello stato successivo dal centro
thrIn = pulseIn(thrPin, HIGH, 25000);
// Hint: thrIn andrebbe calibrato son un Serial.write
if (thrIn != 0) {
- thr = map(thrIn, 960, 2000, 0, 255);
+ thr = map(thrIn, 870, 2000, 0, 255);
};
// RGB
rsotto.lDown(3000);
gsotto.lUp(1000);
- bsotto.lup(2000);
+ bsotto.lUp(2000);
} else if (thr < 245) {
break;
case sx:
- ailerons.Green();
+ ailerons.Red();
if (ail < mid_point + deviation) {
ailstate = middle;
}
Serial.print(ail);
Serial.print("\t ailstate:");
Serial.println(ailstate);
+ //Serial.print("\t mid_point:");
+ //Serial.print(mid_point);
#endif
}
// ISRs