Ciao a tutti,
Il mio adattatore vrc e' passato a miglior vita causa piega oltre il limite fisico, quindi ne ho realizzato uno con una scheedina teensy, sostituibile con un arduino micro.
Con arduino nano purtroppo non funziona, mancando l'interfaccia adeguata che simuli un joystick.
Di seguito trovate foto e Sketch dell'oggetto.
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.
Steve
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);
}