ewok2
Posts: 19
Joined: Mon Jun 16, 2014 3:43 pm

Rasp-Pi 3 + Scratch + GPIO problem

Wed Dec 05, 2018 8:12 pm

Hello
I am running Scratch 1.4 on Raspberry Pi 3 with the "scratchGpio8" version.
I am trying to had some Led blinking.

I put as on the exemple after the "if green Flag" :
Broadcast gpioserveron
Broadcast config11out
Repeat 10
Broadcast pin11high
wait 1
Broadcast pin11low
wait 1

And nothing append..

If in a terminal I launch the "scratchgpio_handler8.py" to try to debug, everything works fine...

Any Idea to avoid to launch the "scratchgpio_handler8.py" and to have scratch working?

thanks

PS : I don't use scratch2 because the goal is to run on rasp-pi zero...

timrowledge
Posts: 1144
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Re: Rasp-Pi 3 + Scratch + GPIO problem

Wed Dec 05, 2018 10:24 pm

Scratch 1.4 (or rather NuScratch as provided on the Pi) has a built-in gpio server. You don’t need scratchgpio in this case. There are things you might want it for and I’ll leave to anyone that uses it to explain more.
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

ewok2
Posts: 19
Joined: Mon Jun 16, 2014 3:43 pm

Re: Rasp-Pi 3 + Scratch + GPIO problem

Thu Dec 06, 2018 9:54 am

Hello
Thanks for the reply
I am not sure to understand..
You mean I have to use the standard scratch in stead of the scratchgpio8?
All Tuto seems to recommande to use this scratchgpio8 when using to control io of the raspberry.

ghp
Posts: 1204
Joined: Wed Jun 12, 2013 12:41 pm
Location: Stuttgart Germany
Contact: Website

Re: Rasp-Pi 3 + Scratch + GPIO problem

Thu Dec 06, 2018 6:02 pm

There are some optional possibilities to connect hardware with scratch
- the 'scratchgpio8 ' approach,
- scratch 1.4 with the embedded 'gpioserver', gpio, pwm, servo, some common boards and more.
- scratch 1.4 or scratch2 with scratchClient.
- or some custom python script.

ewok2
Posts: 19
Joined: Mon Jun 16, 2014 3:43 pm

Re: Rasp-Pi 3 + Scratch + GPIO problem

Thu Dec 06, 2018 9:21 pm

Thanks ghp
I Try "scratchgpio8" with the probleme I put in the first post.
Any idee to solve it ?
Or do you recommand to use another solution ?
Wich one of the one you propose?

ghp
Posts: 1204
Joined: Wed Jun 12, 2013 12:41 pm
Location: Stuttgart Germany
Contact: Website

Re: Rasp-Pi 3 + Scratch + GPIO problem

Fri Dec 07, 2018 10:26 pm

Hello, if you want to do simple things only, then try gpioserver.
This is (current) scratch 1.4 with a build in hardware access. See https://www.raspberrypi.org/documentati ... e/scratch/
Similiar is available for scratch2.

For scratchClient I am somewhat biased, as I have developed this for scratch 1.4 and scratch 2. This tools is intended for school environments, supporting debug access for teachers and the possibility to have sample setup for experiments. And of course extensive documentation. Supports quite a lot of different chips, boards and services. You can send tweets with it, browse openweathermap. Or play with sonicpi by scratch. And of course also GPIO for a LED. Some people use this with an arduino board as general purpose interface board, with wedo2 and someone used build experiments with pi2go robot. It is very flexible but I have to admit that the setup is not a one click operation. See http://heppg.de/ikg/wordpress/?page_id=6

The scratchgpio8 is available since many years and a lot of books refer to this.

Hope this helps,
Gerhard

ewok2
Posts: 19
Joined: Mon Jun 16, 2014 3:43 pm

Re: Rasp-Pi 3 + Scratch + GPIO problem

Sat Dec 08, 2018 2:10 pm

Yes for the begining I want to do some simple things.
But as describe I even do not succeed to make a led blinking.
It may be a privilege problem... because when I launch "scratchgpio_handler8.py" with root privilege the led bink...

Any Idee which user launch scratch and which file should be launch ?
I don't have any message from Scratch GUI that it does not succed to do something!

ghp
Posts: 1204
Joined: Wed Jun 12, 2013 12:41 pm
Location: Stuttgart Germany
Contact: Website

Re: Rasp-Pi 3 + Scratch + GPIO problem

Sat Dec 08, 2018 7:44 pm

Hello,
the commands you use are for gpioserver, which was build into the system by Tim Rowledge.
Using your broadcasts, a LED on my system is blinking.
The attachment scratch_gpio.png is no longer available
I start scratch 1.4 from raspbian menu
start_scratch.png
start_scratch.png (52.7 KiB) Viewed 117 times
The version is ( in scratch. press help)
scratch_gpio.png
scratch_gpio.png (6.44 KiB) Viewed 117 times
When you need root permission, then possibly your system uses an old sd card. Check system version with 'uname -a' in a terminal window

Code: Select all

[email protected]:~ $ uname -a
Linux raspberrypi 4.14.79-v7+ #1159 SMP Sun Nov 4 17:50:20 GMT 2018 armv7l GNU/Linux
[email protected]:~ $
Perhaps you need an update.

ewok2
Posts: 19
Joined: Mon Jun 16, 2014 3:43 pm

Re: Rasp-Pi 3 + Scratch + GPIO problem

Mon Dec 10, 2018 9:50 pm

Ok I have found my problem
The user pi is by default configured to have root access whitout entering a sudo password.
And my user did not!

So I have reinstalled the raspbian with a pi user on scratch 1.4 without gpioserver and it works

Thanks

Return to “Scratch”