Dear Josh, greetings!

Sorry for the slight delay in response. And great that you figured out
your problem. Sorry, I missed the prog; And thanks for updating the
wiki. I just saw the update.

I checked your problem another way without prog. So, I made sure
blinky was working. I then modified blinky and inserted the my-prog
function that calls the blink function. That works fine.

(de blink (pin)
   (pio-pin-setlow pin)
   (delay 100000)
   (pio-pin-sethigh pin)
   (delay 100000) )

(de my-prog ()
     (init-pins)
     (loop
        (if (= 0 (pio-pin-getval button))
           (blink led) ) ) )

> I have put the main code onto the sd card and I use the shell to
> call the function prog-loop.

Perfect! Nothing incorrect here.

> if I change any of it to make it shorter by using shorter function
> names like (de low ()

No; It has nothing to do with the length of function names. Of course,
there's a difference but only really in the micro scale. It wouldn't
matter on Mizar32.

R

On 21 December 2015 at 01:26, Josh <k1llfre...@hotmail.co.uk> wrote:

> Okay so I feel like an idiot for not figuring this out earlier, but I'll
> put it down to not writing picolisp before. Anyways, I figured out what is
> wrong, sbcl if statement works like so:
>
>  (if test-form then-form else-form)
>
> And the Picolisp works the same, and the easiest way to do multiple things
> in the "then-form" is with progn on SBCL, or prog on Picolisp :/ so the
> correct code to get it to blink is:
>
> # 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))
>       (prog (pio-pin-setlow led)
>               (delay 100000)
>               (pio-pin-sethigh led)
>               (delay 100000) ) ) ) )
>
> (prog-loop)
>
>
>
> *drops mic*
> anyways, I got it working using that exact code, I've edited the wiki book.
> *picks up mic and drops it again*
> Thanks :P
>
>
>
> On 20/12/15 13:48, J B wrote:
>
> No circuit just the plain old Mizar B. The Example from the hempl wiki
> book is flashing PB_29. I'm Ubuntu to  connect with terminal.
>
> Sent from my iPhone
>
> On Dec 20, 2015, at 12:12 PM, pd <eukel...@gmail.com> wrote:
>
> sorry if you already said this but what platform are you using? also a
> schematic of your circuit would be interesting even being so simple
>
> On Sun, Dec 20, 2015 at 3:18 AM, Josh <k1llfre...@hotmail.co.uk> wrote:
>
>> 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.couk>
>> k1llfre...@hotmail.co.uk> 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>picolisp@software-lab.de
>>> ?subject=Unsubscribe
>>>
>>
>>
>>
>>
>
>
> --
> Andrés
>
> *~ La mejor manera de librarse de la tentación es caer en ella**. ~ Oscar
> Wilde* ~
>
>
>

Reply via email to