jonfunk209
Posts: 1
Joined: Wed Nov 14, 2018 8:04 pm

Problem with the GPIO extension in Stratch 2

Wed Nov 14, 2018 8:06 pm

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

Forris
Raspberry Pi Certified Educator
Raspberry Pi Certified Educator
Posts: 272
Joined: Fri Jan 06, 2012 7:46 pm

Re: Problem with the GPIO extension in Stratch 2

Fri Nov 16, 2018 1:06 pm

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/

leroylee13
Posts: 3
Joined: Tue May 01, 2018 5:34 am

Re: Problem with the GPIO extension in Stratch 2

Fri Feb 15, 2019 4:11 am

Did you find the fix for this? I just started using the GPIO and found the same issue with the 2 new GPIO blocks.

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

Re: Problem with the GPIO extension in Stratch 2

Sun Feb 17, 2019 8:40 am

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 1291 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.

Return to “Scratch”