Discuss Scratch

ewok002
New to Scratch
4 posts

Rasp-Pi 3 + Scratch + GPIO problem

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…
SimpleScratch
Scratcher
500+ posts

Rasp-Pi 3 + Scratch + GPIO problem

Hi - I'm the author of ScratchGPIO8

Reboot your Pi.

Launch ScratchGPIO8 using desktop icon

Select File - Open, there should be a project called Blink11

Click green flag and see if your LED blinks

If not, make sure you have connected it (through a resistor) to physical pin 11

regards

Simon
ewok002
New to Scratch
4 posts

Rasp-Pi 3 + Scratch + GPIO problem

Hello thanks for reply
Initialy I get this file and try with it
As mentionned it is not a HW pb as when I use this “Blink11” file as you describe nothing append.
But after acting on the green flag if in a terminal I launch “scratchgpio_handler8.py” the led start to blink…

It look like if some initialisation was missing and the script “scratchgpio_handler8.py” do this initialisation…

As I launch this “scratchgpio_handler8.py” as root, maybe it is a privilege problem…
SimpleScratch
Scratcher
500+ posts

Rasp-Pi 3 + Scratch + GPIO problem

Are you logging onto your Pi as standard pi user or some other user?

ScratchGPIO8 only works with standard pi user
ewok002
New to Scratch
4 posts

Rasp-Pi 3 + Scratch + GPIO problem

Yes I use a different user.
But on the instalation it was written :
If logged in as a different user to standard pi, then type sudo bash isgh8.sh yourusername

And that what I have done …

Is it possible to modifie some python file to allow another user ?
SimpleScratch
Scratcher
500+ posts

Rasp-Pi 3 + Scratch + GPIO problem

It may be possible but I only use standard pi user so have no experience of how to do it

Sorry

Last edited by SimpleScratch (Dec. 8, 2018 17:22:40)

ewok002
New to Scratch
4 posts

Rasp-Pi 3 + Scratch + GPIO problem

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 and it works

Thanks
SimpleScratch
Scratcher
500+ posts

Rasp-Pi 3 + Scratch + GPIO problem

Glad you got it sorted
ethajenn
New to Scratch
4 posts

Rasp-Pi 3 + Scratch + GPIO problem

Something else you can always do if in a big pinch is to write the Linux equivalent of a .BAT file, which runs a terminal command that has been pre-written in a text editor and saved as a .BAT. I can't seem to remember the name of the Linux equivalent, but it does exist. So you could have that run, or call it through scratch.
SimpleScratch
Scratcher
500+ posts

Rasp-Pi 3 + Scratch + GPIO problem

ethajenn wrote:

I can't seem to remember the name of the Linux equivalent, but it does exist. So you could have that run, or call it through scratch.

The equivalent in Linux is a .sh file

Althought it wouldn't help at all with this solved issue - it is possible to run an external command using ScratchGPIO

broadcast [run /home/pi/myscript.sh v]

would run myscript.sh

Powered by DjangoBB