Thought it might be a firmware problem or something, so I just re-flashed the firmware but it's still happening, just eliminating possibilities. Also the second of my last emails was the correct one, I canceled the previous but it sent anyways. Thanks.

On 19/12/15 12:50, Josh wrote:
I have put the main code onto the sd card and I use the shell to call the function prog-loop. The light just stays on. I've had this problem before with the example blink program, if I change any of it to make it shorter by using shorter function names like (de low () (pio-pin-setlow 'PB_29)) it doesn't work, but it does when it's just (pio-pijn-setlow 'PB_29). I don't really know what's going on, but it's starting to get irritating.
On 19/12/15 03:45, Raman Gopalan wrote:


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 <k1llfre...@hotmail.co.uk <mailto:k1llfre...@hotmail.couk>> 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:picolisp@software-lab.de
    <mailto:picolisp@software-lab.de>?subject=Unsubscribe




Reply via email to