Dear Josh, greetings! Firstly, great to know you're playing with your board! Perfect!
> Why does this small amount of code not make the onboard LED flash? I think you're not providing enough delay for you to see the off state of the LED. Why don't you try this? I've just inserted an additional delay. (pio-pin-setdir *pio-output* 'PB_29) (pio-pin-sethigh 'PB_29) (loop (pio-pin-setlow 'PB_29) (tmr-delay 0 100000) (pio-pin-sethigh 'PB_29) (tmr-delay 0 100000) ) > Any ideas? Also this example on the hempl wiki book: This example doesn't blink the on-board LED. It just reads the status of an input pin (SW-1 I think; the one near the voltage regulator) and turns the blue LED on when this input switch is pressed. > # And now, the main loop > (de prog-loop () > (init-pins) > (loop > (if (= 0 (pio-pin-getval button)) > (pio-pin-setlow led) > (delay 100000) > (pio-pin-sethigh led) > (delay 100000) ) ) ) Please copy the example on your micro-SD card and point picolisp in the direction of this file. If this doesn't happen, something strange is happening. We can then debug. But I'm almost certain it'll work :) Hempl# picolisp /mmc/user-button.l R P.S. You may also use the internal transient symbol `*tmr-sys-timer*' in the function tmr-delay. I think it uses a hardware PWM channel to generate the time (can't remember which; I'll have to see the sources again). That makes the timing accurate. On 18 December 2015 at 22:08, Josh <[email protected]> wrote: > Why does this small amount of code not make the onboard LED flash? > (pio-pin-setdir *pio-output* 'PB_29) > (pio-pin-sethigh 'PB_29) > (loop (pio-pin-setlow 'PB_29) > (tmr-delay 0 100000) > (pio-pin-sethigh 'PB_29)) > All that happens in the blue LED turns on and stays on, even though the > code clearly says for it to go from high to low repeatedly. Any ideas? Also > this example on the hempl wiki book: > > # A simple program which demonstrates > # the usage of user-buttons. > # declare pins > (setq led 'PB_29 button 'PX_16) > > # a simple delay function > (de delay (t) > (tmr-delay 0 t) ) > > # make sure the LED starts in > # the "off" position and enable > # input/output pins > (de init-pins () > (pio-pin-sethigh led) > (pio-pin-setdir *pio-output* led) > (pio-pin-setdir *pio-input* button) ) > > # And now, the main loop > (de prog-loop () > (init-pins) > (loop > (if (= 0 (pio-pin-getval button)) > (pio-pin-setlow led) > (delay 100000) > (pio-pin-sethigh led) > (delay 100000) ) ) ) > > (prog-loop) > > Doesn't make the LED flash it just stays on. > > -- > UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe >
