[squeak-dev] Talking to the real world from Squeak on a Rasppi
Douglas McPherson
djm1329 at san.rr.com
Fri Apr 11 15:31:01 UTC 2014
I also had success playing with some Scratch-Python connections. Here's some notes I made experimenting with it a few months ago.
Scratch (http://pihw.wordpress.com/lessons/rgb-led-lesson-2-scratch-gpio-getting-started/)
(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
http://www.pridopia.co.uk/rs-pi-set-scratch.html
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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20140411/a36ba9ac/attachment.htm
More information about the Squeak-dev
mailing list
|