Ok i made a RX PWM tester with arduino because Im struggling to get PWM signal from my nano RX ESC to power the weapons. I really need to know what is being output from the PWM pads. I suck at electronics, but the reason I started insect combat robotics was to learn something about electronics ..
![Smile :)](./images/smilies/icon_e_smile.gif)
and this has been the biggest lesson so far! So it's all good
Video of it working here with a FrSky V8R4-II . Next to test it tomorrow night with the nano and find out why my giant weapon of death wont spin!
https://photos.app.goo.gl/9o1nqEBQbL4ofhRE6
Maybe one other builder will find the arduino code useful for checking their own RX outputs.
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
Or for making lil LEDs flash with your transmitter. Disco! disco! disco! disco! (my darksynth music is perhaps not actually good disco music..
![Neutral :|](./images/smilies/icon_neutral.gif)
)
It's not perfect, as Im mega new to Arduino, but the code is here.
Code: Select all
/* PWM RECEIVER VALUES TEST AND VISUAL LED INDICATION
* LAUNCH SERIAL MONITOR
*/
int CH1=10; /*pin 10 plug in LED 1*/
int CH2=11; /*pin 11 plug in LED 2*/
int CH3=3; /*pin 3 plug in LED 3*/
int CH4=6; /*pin 6 plug in LED 4*/
int Map1;
int Map2;
int Map3;
int Map4;
double channel[4];
void setup() {
pinMode(10,OUTPUT); /*pin 10 plug in LED 1*/
pinMode(11,OUTPUT); /*pin 11 plug in LED 2*/
pinMode(3,OUTPUT); /*pin 3 plug in LED 3*/
pinMode(6,OUTPUT); /*pin 6 plug in LED 4*/
pinMode(2,INPUT); /*pin 2 plug in RX Signal Channel 1*/
pinMode(5,INPUT); /*pin 5 plug in RX Signal Channel 2*/
pinMode(7,INPUT); /*pin 7 plug in RX Signal Channel 3*/
pinMode(9,INPUT); /*pin 9 plug in RX Signal Channel 4*/
Serial.begin(9600);
}
void loop() {
channel[0]= pulseIn(2,HIGH);
channel[1]= pulseIn(5,HIGH);
channel[2]= pulseIn(7,HIGH);
channel[3]= pulseIn(9,HIGH);
Serial.print(channel[0]);
Serial.print("--++++--");
Serial.print(channel[1]);
Serial.print("--++++--");
Serial.print(channel[2]);
Serial.print("--++++--");
Serial.println(channel[3]);
Map1=map(channel[0],975,2000,0,255);
analogWrite(CH1,Map1);
if (channel[0]<975){
digitalWrite(CH1,LOW);
}
channel[1]=(channel[1]-1500);
channel[1]= sqrt((channel[1]*channel[1]));
Map2=map(channel[1],0,500,0,255);
analogWrite(CH2,Map2);
if (channel[1]<25){
digitalWrite(CH2,LOW);
}
channel[2]=(channel[2]-1500);
channel[2]= sqrt((channel[2]*channel[2]));
Map3=map(channel[2],0,500,0,255);
analogWrite(CH3,Map3);
if (channel[2]<25){
digitalWrite(CH3,LOW);
}
channel[3]=(channel[3]-1500);
channel[3]= sqrt((channel[3]*channel[3]));
Map4=map(channel[3],0,500,0,255);
analogWrite(CH4,Map4);
if (channel[3]<25){
digitalWrite(CH4,LOW);
}
delay(100);
}
EDIT: Nano is dead on the PWM pins. Channel 3, 4 and 6 are outputting from the TX on the throttle. Arduino measuring the RX outputs on the PWM pad shows nothing
![Sad :(](./images/smilies/icon_e_sad.gif)
Guess I'll use this board for a pushbot and order another one.
https://photos.app.goo.gl/ZzuQHzqDTwh8Eaoh6