I used a scope to check out the GP P1 header pins' waveforms. P1-1 and P1-3 display pulses of frequency of period 75 mS. The Guzunty Pi's demo program is in C and a bit difficult for me to understand what is going on. So I think I better write my own newbie Python program to do the testing.
void exercise_pwms() {
unsigned char payload[2];
reg += dir;
if (reg == 7 || reg == 0) {
dir = -dir;
}
values[reg] = 0x1f;
int i;
for(i = 0; i < 8; i++) {
payload[0] = i;
payload[1] = 0x1f - values[i];
if (values[i] > 1) {
values[i] -= 2;
}
else {
values[i] = 0;
}
gz_spi_write(payload);
}
usleep(100000);
}
.END
No comments:
Post a Comment