For the '~/pico/pico-examples/pio/hello_pio/hello.c' example; that has an infinite 'while(true)' loop which will repeatedly turn the LED on and off, so should never exit.And I also realized that once the state machine of the PIO is running, the main c++ program ends (unless with an extra while(true) loop), and then '/dev/ttyACM0' is lost.
The example does only demonstrate PIO operation but it is possible to add code which reports when the LED is turned on and off. It will be best if the time delay between toggling on and off is extended -I also realize that there is no wonder nobody asks about it because the state machines themselves don't do serial output, so enabling the option does not make sense if only the state machines are running.
Code:
while (true) { // Blink pio_sm_put_blocking(pio, sm, 1); printf("LED is on\n"); sleep_ms(2000); // Blonk pio_sm_put_blocking(pio, sm, 0); printf("LED is off\n"); sleep_ms(2000); }
Statistics: Posted by hippy — Wed Apr 17, 2024 10:53 am