Page 1 of 1

Rasp-Pi 3 + Scratch + GPIO problem

Posted: Wed Dec 05, 2018 8:12 pm
by ewok2
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...

Re: Rasp-Pi 3 + Scratch + GPIO problem

Posted: Wed Dec 05, 2018 10:24 pm
by timrowledge
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.

Re: Rasp-Pi 3 + Scratch + GPIO problem

Posted: Thu Dec 06, 2018 9:54 am
by ewok2
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.

Re: Rasp-Pi 3 + Scratch + GPIO problem

Posted: Thu Dec 06, 2018 6:02 pm
by ghp
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.

Re: Rasp-Pi 3 + Scratch + GPIO problem

Posted: Thu Dec 06, 2018 9:21 pm
by ewok2
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?

Re: Rasp-Pi 3 + Scratch + GPIO problem

Posted: Fri Dec 07, 2018 10:26 pm
by ghp
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

Re: Rasp-Pi 3 + Scratch + GPIO problem

Posted: Sat Dec 08, 2018 2:10 pm
by ewok2
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!

Re: Rasp-Pi 3 + Scratch + GPIO problem

Posted: Sat Dec 08, 2018 7:44 pm
by ghp
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 3692 times
The version is ( in scratch. press help)
scratch_gpio.png
scratch_gpio.png (6.44 KiB) Viewed 3692 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

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

Re: Rasp-Pi 3 + Scratch + GPIO problem

Posted: Mon Dec 10, 2018 9:50 pm
by ewok2
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