Re: bitmaps from random

2015-12-21 Thread Christophe Gragnic
On Mon, Dec 21, 2015 at 10:58 PM, Erik Gustafson
 wrote:
> Hi,
>
> […]
>
> The built-in 'wr' does just that - writes raw bytes to the current output
> channel.

Indeed. I missed this one. Thanks.
Oops, it seems that Ersatz doesn't have it.

On Mon, Dec 21, 2015 at 11:12 PM, Loyall, David
 wrote:
>> Suppose I implement the bmp format.
>
> Or, https://en.wikipedia.org/wiki/Netpbm

Useful, and in the spirit of PicoLisp (using external programs). Thanks.
In fact the implementation has already been done as a (fun) exercise
(and I need to rely on PicoLisp only).


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info (langage de programmation pédagogique)
http://expressions.club/ (structure des expressions mathématiques)
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Why won't the LED flash?

2015-12-21 Thread Raman Gopalan
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 10)
   (pio-pin-sethigh pin)
   (delay 10) )

(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  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 10)
>   (pio-pin-sethigh led)
>   (delay 10) ) ) ) )
>
> (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  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  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 10)
>>(pio-pin-sethigh 'PB_29)
>>(tmr-delay 0 10) )
>>
>> > 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 10)
>> >  (pio-pin-sethigh led)
>> >  (delay 10) ) ) )
>>
>> 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 

RE: bitmaps from random

2015-12-21 Thread Loyall, David
> Suppose I implement the bmp format.

Or, https://en.wikipedia.org/wiki/Netpbm

Cheers,
--Dave 


Re: bitmaps from random

2015-12-21 Thread Erik Gustafson
Hi,

Is there a way to do the conversion with pure PicoLisp?
> Suppose I implement the bmp format.
> I have a list of bits,
> that I group by 8 to have a list of bytes,
> then how can PicoLisp write these raw bytes to a file?


The built-in 'wr' does just that - writes raw bytes to the current output
channel.


Re: bitmaps from random

2015-12-21 Thread Christophe Gragnic
On Mon, Dec 21, 2015 at 9:13 PM, Mike Pechkin  wrote:
>
> code is here:
> https://bitbucket.org/mihailp/tankfeeder/src/4449cee7f84899243d8ce2799779caf3457f7cc2/random.l?at=default&fileviewer=file-view-default
>
> the *only* source of info from google:
> http://www.imagemagick.org/discourse-server/viewtopic.php?t=26710

Thanks for sharing this.

Is there a way to do the conversion with pure PicoLisp?
Suppose I implement the bmp format.
I have a list of bits,
that I group by 8 to have a list of bytes,
then how can PicoLisp write these raw bytes to a file?


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info (langage de programmation pédagogique)
http://expressions.club/ (structure des expressions mathématiques)
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: bitmaps from random

2015-12-21 Thread Mike Pechkin
hi,


code is here:
https://bitbucket.org/mihailp/tankfeeder/src/4449cee7f84899243d8ce2799779caf3457f7cc2/random.l?at=default&fileviewer=file-view-default

the *only* source of info from google:
http://www.imagemagick.org/discourse-server/viewtopic.php?t=26710




On Mon, Dec 21, 2015 at 8:04 PM, Christophe Gragnic <
christophegrag...@gmail.com> wrote:

> On Mon, Dec 21, 2015 at 2:43 PM, Mike Pechkin 
> wrote:
> > hi,
> >
> > bitmaps from (rand) from pil32 and pil64
> > done by "convert" from ImageMagic soft.
> >
> > now looks ok.
> > http://imgur.com/a/bYaAr
>
> Interesting.
> Could you please provide some more details? Like:
> * the PicoLisp code
> * Are pixels pure white or pure black according to (rand T)?
> * the convert command
> * Is there a nice option like «turn a list of 0 and 1 to a bitmap»?
> Thanks.
>
> chri
>
> --
>
> http://profgra.org/lycee/ (site pro)
> http://delicious.com/profgraorg (liens, favoris)
> https://twitter.com/profgraorg
> http://microalg.info (langage de programmation pédagogique)
> http://expressions.club/ (structure des expressions mathématiques)
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subjectUnsubscribe
>


Re: bitmaps from random

2015-12-21 Thread Christophe Gragnic
On Mon, Dec 21, 2015 at 2:43 PM, Mike Pechkin  wrote:
> hi,
>
> bitmaps from (rand) from pil32 and pil64
> done by "convert" from ImageMagic soft.
>
> now looks ok.
> http://imgur.com/a/bYaAr

Interesting.
Could you please provide some more details? Like:
* the PicoLisp code
* Are pixels pure white or pure black according to (rand T)?
* the convert command
* Is there a nice option like «turn a list of 0 and 1 to a bitmap»?
Thanks.

chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info (langage de programmation pédagogique)
http://expressions.club/ (structure des expressions mathématiques)
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: bitmaps from random

2015-12-21 Thread Henrik Sarvell
Neat trick to test RNGs, so obvious in hindsight.

On Mon, Dec 21, 2015 at 3:49 PM, Mike Pechkin 
wrote:

> yes, influenced by
> http://goo.gl/zhTijq
>
>
> On Mon, Dec 21, 2015 at 3:43 PM, Mike Pechkin 
> wrote:
>
>> hi,
>>
>> bitmaps from (rand) from pil32 and pil64
>> done by "convert" from ImageMagic soft.
>>
>> now looks ok.
>> http://imgur.com/a/bYaAr
>>
>> Mike
>>
>>
>


Re: CentOS 7 x64

2015-12-21 Thread Mike Pechkin
if you run "make all" add to list:
 ... glibc-devel openssl-devel

Mike



On Mon, Dec 21, 2015 at 5:35 PM, Mike Pechkin 
wrote:

> hi,
>
> when centos installed from centOS7-Miminimal.iso you should install
> required rpm by:
> $ yum install gcc glibc-devel.i686 libstdc++-devel.i686
>
> Mike
>
>
>
> On Mon, Dec 21, 2015 at 4:58 PM, Mike Pechkin 
> wrote:
>
>> hi,
>>
>> news from porting sandbox:
>> checked, pil32 and pil64 compiles on CentOS7 out of box,
>> when all required rpms are installed.
>>
>> Mike
>>
>>
>>
>>
>> On Mon, Dec 21, 2015 at 3:34 PM, Mike Pechkin 
>> wrote:
>>
>>> hi,
>>>
>>> latest picolisp (32 and 64) cant compile on CentOS 7 out of box.
>>> installing to vmware to check.
>>> plz, stand by.
>>>
>>> Mike
>>>
>>>
>>
>


Re: CentOS 7 x64

2015-12-21 Thread Mike Pechkin
hi,

when centos installed from centOS7-Miminimal.iso you should install
required rpm by:
$ yum install gcc glibc-devel.i686 libstdc++-devel.i686

Mike



On Mon, Dec 21, 2015 at 4:58 PM, Mike Pechkin 
wrote:

> hi,
>
> news from porting sandbox:
> checked, pil32 and pil64 compiles on CentOS7 out of box,
> when all required rpms are installed.
>
> Mike
>
>
>
>
> On Mon, Dec 21, 2015 at 3:34 PM, Mike Pechkin 
> wrote:
>
>> hi,
>>
>> latest picolisp (32 and 64) cant compile on CentOS 7 out of box.
>> installing to vmware to check.
>> plz, stand by.
>>
>> Mike
>>
>>
>


Re: CentOS 7 x64

2015-12-21 Thread Mike Pechkin
hi,

news from porting sandbox:
checked, pil32 and pil64 compiles on CentOS7 out of box,
when all required rpms are installed.

Mike




On Mon, Dec 21, 2015 at 3:34 PM, Mike Pechkin 
wrote:

> hi,
>
> latest picolisp (32 and 64) cant compile on CentOS 7 out of box.
> installing to vmware to check.
> plz, stand by.
>
> Mike
>
>


Re: bitmaps from random

2015-12-21 Thread Mike Pechkin
yes, influenced by
http://goo.gl/zhTijq


On Mon, Dec 21, 2015 at 3:43 PM, Mike Pechkin 
wrote:

> hi,
>
> bitmaps from (rand) from pil32 and pil64
> done by "convert" from ImageMagic soft.
>
> now looks ok.
> http://imgur.com/a/bYaAr
>
> Mike
>
>


bitmaps from random

2015-12-21 Thread Mike Pechkin
hi,

bitmaps from (rand) from pil32 and pil64
done by "convert" from ImageMagic soft.

now looks ok.
http://imgur.com/a/bYaAr

Mike


CentOS 7 x64

2015-12-21 Thread Mike Pechkin
hi,

latest picolisp (32 and 64) cant compile on CentOS 7 out of box.
installing to vmware to check.
plz, stand by.

Mike


Re: Why won't the LED flash?

2015-12-21 Thread andreas
Hi Josh

Cool you figured it out! 
When you have an (if) without any else statements, you could use (when) instead.

Regards
- beneroth

- Original Message -
From: Josh [mailto:k1llfre...@hotmail.co.uk]
To: picolisp@software-lab.de
Sent: Mon, 21 Dec 2015 00:26:53 +
Subject: Re: Why won't the LED flash?

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 10)
   (pio-pin-sethigh led)
   (delay 10) ) ) ) )

(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  > 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 > > 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 10)
(pio-pin-sethigh 'PB_29)
(tmr-delay 0 10) )

 > 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 10)
 >  (pio-pin-sethigh led)
 >  (delay 10) ) ) )

 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 >>> > wrote:

 Why does this small amount of code not make the onbo