Code:
#include <PWMServo.h>
int channel[8];
int PPMin = 23;
#define TH1 2
#define TH2 3
PWMServo throttel1;
PWMServo throttel2;
void setup() {
Serial.begin(9600);
throttel1.attach(TH1);
throttel2.attach(TH2);
}
void loop() {
if (pulseIn(PPMin, HIGH) > 4000)
{
for (int i = 1; i <= channumber; i++)
{
channel[i - 1] = pulseIn(PPMin, HIGH);
}
int throttle_input = channel[2];
Serial.print("CH[3]: "); Serial.print(channel[2]);
int throttle1_input = map(throttle_input, 1497, 519, 0, 180);
throttel1.write(throttle1_input);
int throttle2_input = map(throttle_input, 1497, 519, 0, 180);
throttel1.write(throttle2_input);
}
}
Hi @pilot011, welcome to the Teensy fold.
Can I request that in future, when you put code into your posting, can you enclose the code between CODE tags using the # button as I have done above for your code.
It makes it so much easier for someone to read and potentially help solve your problem.
Incidentally the code that you presented will NOT compile with the following error, error: 'channumber' was not declared in this scope.