Thanks for the reply, but that time is 1/5th of the time for the
blinking LED example, and 1/5th a second is enough for an eye to see.
Anyways, this little bit:
> (pio-pin-setlow led)
> (delay 100000)
> (pio-pin-sethigh led)
> (delay 100000) ) ) )
Is exactly the same as the code from the "quick start" where it makes
the LED blink, it only uses a shorter time period. Another thing, on the
Hempl website where I copy and pasted the code, it says " We will read
the pin connected to the onboard user button and, as long as it is
pressed down, we will make the on-board LED flicker. I"
But it doesn't blink, I adjusted the times to make them five times
higher and it just waits around 1 second and the LED turns on but
doesn't blink like it should. Any ideas? It should blink, clearly
setting it from on then off and looping it should blink, but it won't.
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