Weird PPM readings
hi,
i getting weird readings of ppm spektrum ar8000 receiver on data/bind port (supposed ppm signal according reply spektrum).
i using arduino pro mini 3v/8mhz clone.
here's code:
here's example output:
any ideas on can wrong this?
(why there 19 channels, why these numbers small , why changing joystick positions @ transmitter doesn't have affect on output).
i getting weird readings of ppm spektrum ar8000 receiver on data/bind port (supposed ppm signal according reply spektrum).
i using arduino pro mini 3v/8mhz clone.
here's code:
code: [select]
#define pin 2 // arduino pro mini 3v/8mhz
#define n 100 // max channels
#define frameendthreshold 4000
int chans[n];
int next; // next position in chans
bool capturing = false;
void setup() {
serial.begin(115200);
pinmode(pin, input);
}
void loop() {
int w = pulsein(pin, high);
if (capturing) {
if (next < n) { // record channel
chans[next] = w;
next++;
}
if (w > frameendthreshold) { // print if frame end detected
serial.print(next);
serial.print(": ");
(int = 0; < next; i++) {
serial.print(chans[i]);
serial.print(i != (next - 1) ? " - " : "\n");
}
capturing = false;
}
} else {
if (w > frameendthreshold) { // start recording if frame end detected
capturing = true;
next = 0;
}
}
}
here's example output:
code: [select]
⸮4⸮4⸮⸮$4⸮\⸮⸮$t⸮\⸮⸮e⸮⸮⸮⸮⸮⸮⸮$4⸮4⸮⸮⸮4⸮⸮$4ะด⸮⸮$4⸮⸮⸮⸮e⸮t⸮⸮⸮⸮^d⸮.⸮⸮%⸮⸮⸮⸮⸮⸮⸮$⸮^⸮$⸮17: 9 - 9 - 18 - 9 - 9 - 9 - 9 - 18 - 78 - 9 - 27 - 18 - 79 - 9 - 9 - 9 - 20484
19: 9 - 9 - 18 - 9 - 9 - 9 - 9 - 9 - 26 - 18 - 72 - 9 - 27 - 18 - 79 - 10 - 9 - 9 - 20511
17: 9 - 9 - 9 - 9 - 10 - 9 - 26 - 18 - 78 - 9 - 27 - 18 - 78 - 9 - 9 - 9 - 20466
16: 9 - 9 - 18 - 9 - 9 - 9 - 9 - 18 - 79 - 10 - 18 - 79 - 9 - 9 - 9 - 20544
17: 10 - 9 - 18 - 9 - 6 - 9 - 9 - 18 - 78 - 9 - 27 - 18 - 79 - 10 - 9 - 9 - 20458
17: 9 - 9 - 18 - 9 - 9 - 9 - 10 - 18 - 79 - 9 - 26 - 18 - 78 - 9 - 9 - 9 - 20520
17: 10 - 9 - 18 - 9 - 10 - 9 - 9 - 18 - 78 - 9 - 27 - 18 - 78 - 9 - 9 - 9 - 20459
17: 9 - 9 - 18 - 9 - 9 - 9 - 9 - 18 - 78 - 9 - 27 - 18 - 79 - 10 - 9 - 9 - 20502
18: 9 - 9 - 18 - 9 - 9 - 9 - 9 - 27 - 18 - 78 - 9 - 27 - 18 - 78 - 9 - 9 - 9 - 20487
17: 10 - 9 - 18 - 9 - 10 - 9 - 9 - 18 - 78 - 9 - 27 - 18 - 72 - 9 - 9 - 9 - 20502
16: 9 - 10 - 9 - 9 - 9 - 9 - 18 - 79 - 9 - 27 - 18 - 78 - 9 - 9 - 9 - 20496
17: 9 - 9 - 18 - 9 - 9 - 9 - 10 - 18 - 79 - 9 - 26 - 18 - 72 - 9 - 9 - 9 - 20511
17: 9 - 9 - 18 - 9 - 10 - 9 - 9 - 18 - 78 - 9 - 27 - 18 - 78 - 9 - 9 - 9 - 20501
18: 9 - 9 - 18 - 9 - 9 - 10 - 9 - 26 - 18 - 78 - 9 - 27 - 18 - 78 - 9 - 9 - 9 - 20512
17: 9 - 9 - 18 - 9 - 9 - 9 - 9 - 18 - 78 - 9 - 27 - 18 - 79 - 10 - 9 - 9 - 20502
18: 9 - 9 - 15 - 9 - 9 - 9 - 9 - 10 - 18 - 79 - 9 - 26 - 18 - 78 - 9 - 9 - 9 - 20511
18: 9 - 9 - 9 - 9 - 9 - 9 - 9 - 26 - 18 - 72 - 9 - 27 - 18 - 79 - 10 - 9 - 9 - 20510
17: 9 - 9 - 18 - 7 - 9 - 9 - 10 - 18 - 79 - 9 - 26 - 18 - 78 - 9 - 9 - 9 - 20511
19: 9 - 9 - 18 - 10 - 9 - 9 - 9 - 9 - 27 - 18 - 78 - 9 - 27 - 18 - 78 - 9 - 9 - 9 - 20510
17: 9 - 9 - 9 - 5 - 9 - 9 - 9 - 18 - 78 - 9 - 27 - 18 - 78 - 9 - 9 - 9 - 20519
16: 9 - 9 - 18 - 9 - 9 - 9 - 9 - 18 - 78 - 9 - 18 - 79 - 9 - 9 - 9 - 20502
17: 9 - 9 - 18 - 9 - 9 - 9 - 9 - 18 - 79 - 9 - 27 - 18 - 78 - 9 - 9 - 9 - 20485
16: 9 - 9 - 9 - 9 - 10 - 9 - 18 - 78 - 9 - 27 - 18 - 78 - 9 - 9 - 9 - 20493
any ideas on can wrong this?
(why there 19 channels, why these numbers small , why changing joystick positions @ transmitter doesn't have affect on output).
Arduino Forum > Using Arduino > Networking, Protocols, and Devices (Moderator: fabioc84) > Weird PPM readings
arduino
Comments
Post a Comment