Talking to the real world from Squeak on a Rasppi

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Talking to the real world from Squeak on a Rasppi

Herbert König
Hi,

how do I use the camera and do IO on the Pi from Squeak?

I managed to connect two Squeak images on the Pi via UDP so I think I
could write (copy :-)) some python to do the IO and talk to Squeak via
sockets.

Are there alternatives? Plugins? How does Scratch do it?

Thanks,

Herbert

Reply | Threaded
Open this post in threaded view
|

Re: Talking to the real world from Squeak on a Rasppi

douglas mcpherson
I also had success playing with some Scratch-Python connections. Here's some notes I made experimenting with it a few months ago.


(playing with the scratch-gpio python hack)
sudo wget https://dl.dropbox.com/s/gery97qildl7ozd/install_scratch_gpio.sh -O /boot/install_scratch_gpio.sh

sudo /boot/install_scratch_gpio.sh

This installs a new desktop icon "scratch-gpio", which, when clicked starts scratch and a python script "scratch_gpio_handler.py". Scratch connects to this python script over a tcp socket and receives scratch "broadcast" messages, which, if are "pin12high", "pin18off" type messages then the appropriate function from RPi.GPIO is invoked.

Note: had to update the python script "scratch_gpio_handler.py" to initialize GPIO as BCM instead of BOARD. Also added a new GPIO 23 as output. Note that the array GPIO_NUM isn't used at all ... not really sure what it is for since the entries in the PIN_NUM array are GPIO numbers themselves.

These guys appear to have even better support ... not just GPIO but I2C, SPI, etc

There's also OSProcess. The plain Squeak interpreter that ships with recent raspian will work if you install OSProcess and OSShell. I used that to invoke pyhton scrips directly instead of over a socket.

With tons of help from Eliot and Tim I am currently adding support for ThreadedFFIPlugin for the pi's ARM (and hopefully other ARMs too). I'm hoping to have something basic ready in a couple of weeks.

Doug 





On Apr 11, 2014, at 07:23 , Herbert König wrote:

Hi,

how do I use the camera and do IO on the Pi from Squeak?

I managed to connect two Squeak images on the Pi via UDP so I think I could write (copy :-)) some python to do the IO and talk to Squeak via sockets.

Are there alternatives? Plugins? How does Scratch do it?

Thanks,

Herbert




Reply | Threaded
Open this post in threaded view
|

Re: Talking to the real world from Squeak on a Rasppi

timrowledge
In reply to this post by Herbert König

On 11-04-2014, at 7:23 AM, Herbert König <[hidden email]> wrote:

> Hi,
>
> how do I use the camera and do IO on the Pi from Squeak?
>
> I managed to connect two Squeak images on the Pi via UDP so I think I could write (copy :-)) some python to do the IO and talk to Squeak via sockets.
>
> Are there alternatives? Plugins? How does Scratch do it?

Scratch uses the CameraPlugin and on a Pi with the latest v4linux stuff it works *but* (in Scratch at least) the colour map is wrong. I haven’t put any serious effort into it but I think it is swapping R & G - so think BGR instead of RGB. There ought to be a simple setting to switch this, apparently. I’ve also been told that v4l ought not be needed for the fairly simple work the CameraPlugin needs to do.

The general case for IO - assuming you mostly mean the GPIO pins, is/will be to use the FFI stuff Doug McPherson is getting to grips with. It might be worth making a simple plugin for your specific needs if you need it now; it’s hard to know exactly how much work the ffi requires!


tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Fractured Idiom:- HASTE CUISINE - Fast French food



Reply | Threaded
Open this post in threaded view
|

Re: Talking to the real world from Squeak on a Rasppi

Bert Freudenberg
In reply to this post by Herbert König
On 11.04.2014, at 07:23, Herbert König <[hidden email]> wrote:

> Hi,
>
> how do I use the camera and do IO on the Pi from Squeak?

For GPIO you could use WebIOPi:

        https://code.google.com/p/webiopi/

- Bert -





smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Talking to the real world from Squeak on a Rasppi

Herbert König
In reply to this post by Herbert König
Thanks to all three,

the pointers revealed a wealth of information!

Cheers

Herbert.

Am 11.04.2014 16:23, schrieb Herbert König:

> Hi,
>
> how do I use the camera and do IO on the Pi from Squeak?
>
> I managed to connect two Squeak images on the Pi via UDP so I think I
> could write (copy :-)) some python to do the IO and talk to Squeak via
> sockets.
>
> Are there alternatives? Plugins? How does Scratch do it?
>
> Thanks,
>
> Herbert
>