Page 1 of 1

Problem with the GPIO extension in Stratch 2

Posted: Wed Nov 14, 2018 8:06 pm
by jonfunk209
Hello.

I am doing some scratch 2 programming on the PI and the GPIO extension is acting strange. I can not drag variables into the set gpio to block. It just allows me to pick the number. Is there something I can do to fix this.

thanks,

Jon Funk
jonfunk209 @ gmail.com

Re: Problem with the GPIO extension in Stratch 2

Posted: Fri Nov 16, 2018 1:06 pm
by Forris
Personally, I don't bother with the 'built-in' version of Scratch on the Pi.

I use Scratchgpio instead, as it does way more and isn't as flaky.

http://simplesi.net/scratchgpio/

Re: Problem with the GPIO extension in Stratch 2

Posted: Fri Feb 15, 2019 4:11 am
by leroylee13
Did you find the fix for this? I just started using the GPIO and found the same issue with the 2 new GPIO blocks.

Re: Problem with the GPIO extension in Stratch 2

Posted: Sun Feb 17, 2019 8:40 am
by ghp
Hello, the design of the blocks is made to use pick list with available GPIO.
If you need to address gpio by number, then you can write a wrapper which provides this possibility.
Here an idea how this could work:
variable_output.jpg
variable_output.jpg (36.12 KiB) Viewed 2602 times
You set a variable with the gpio-number to set (here 'gpio') and then send a message to the script resolving the number into the gpio blocks.
Still room for improvements here: The name of the message could be better. And when having many GPIO, the runtime is long for those later in the nested if structure. But there are possibilities to make it better...
With scratch2, you can use 'make a block' to solve this a little bit smarter.