Visualizza messaggio singolo
Vecchio 08 settembre 21, 10:57   #2 (permalink)  Top
Smsteves
User
 
Data registr.: 03-05-2020
Residenza: milano
Messaggi: 47
Ecco la foto dell' oggetto, testato e funzionante.
Di seguito lo sketch in versione Teensi 3.2.
Il led a bordo scheda funziona come Indicatore di ricezione segnale.
Spegnendo la Trasmittente resta acceso Fisso e imposta il failsafe, con segnale TX in arrivo lampeggia velocemente.
Codice:
 
/*
 * Created by Smsteves
 * Date 06/09/2020 V 0.1
 * Project: Arduino/Teensy VRC link adapter  
 * 0.1 initial Release
*/
 
       
unsigned int Rxpulse;
unsigned int Gaspulse ;

const int ledPin = 13;
boolean L=HIGH;

void setup() {
pinMode(0, INPUT); //-- front servo signal in pin
pinMode(1, INPUT); //-- throttle signal in pin
pinMode(ledPin, OUTPUT);

}
void loop(){

noInterrupts();   
Rxpulse = pulseIn(0, HIGH,20000);
delay(1);
Gaspulse = pulseIn(1, HIGH,20000);
delay(1);

interrupts(); 
Gaspulse-=1000;
Rxpulse-=1000;

if (Rxpulse >3000) {
Rxpulse =512;
Gaspulse=512;
  digitalWrite(ledPin, HIGH);
}
else{
 L = !L;
   digitalWrite(ledPin, L); 
}
  Joystick.X(Rxpulse);
  Joystick.Y(Gaspulse);
}
Steve
Icone allegate
Interfaccia VRC con Arduino/Teensy-photo_2021-09-08_10-49-53.jpg  
Smsteves non รจ collegato   Rispondi citando