yves.morele
Active member
the connections on arduino nano:
D5 connected with a Y to the throttle signal (channel 3 normally)
D3 led control output (0-5 volts)
the ground and + 5V of the arduino taken on the Y of the throttle
the simple code
int changethrottle;
int voltageledrouge;
int voltageledbleue;
void setup() {
pinMode(5, INPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
Serial.begin(9600);
}
void loop() {
changethrottle = pulseIn(5, HIGH, 25000);
voltageledrouge=map(changethrottle, 1000, 2000, 0, 255);
voltageledbleue=map(changethrottle, 2000, 1000, 0,255);
if (changethrottle<1250) voltageledrouge=0;
if (changethrottle>1500) voltageledbleue=0;
analogWrite(3,voltageledrouge);
analogWrite(4,voltageledbleue);
delay(10);
}
D5 connected with a Y to the throttle signal (channel 3 normally)
D3 led control output (0-5 volts)
the ground and + 5V of the arduino taken on the Y of the throttle
the simple code
int changethrottle;
int voltageledrouge;
int voltageledbleue;
void setup() {
pinMode(5, INPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
Serial.begin(9600);
}
void loop() {
changethrottle = pulseIn(5, HIGH, 25000);
voltageledrouge=map(changethrottle, 1000, 2000, 0, 255);
voltageledbleue=map(changethrottle, 2000, 1000, 0,255);
if (changethrottle<1250) voltageledrouge=0;
if (changethrottle>1500) voltageledbleue=0;
analogWrite(3,voltageledrouge);
analogWrite(4,voltageledbleue);
delay(10);
}