ScratchGPIO development Version
Here is the latest development version of ScratchGPIO for testing
Installing
wget https://git.io/vMSip -O isgh8dev.sh
Once the installer has been downloaded then just type (or copy and paste the text below as before)
sudo bash isgh8dev.sh
New Features
Support for 4Tronix PiConZero board ic digital,pwm and servo outputs and neopixels
Calling external programs
broadcast run python test.py
will run an external program (in the /home/pi folder) called test.py
Improved H-Bridge motor control
Just find out which 2 pins control your H-Bridge motor and create a variable to control its speed from -100 to 100
e.g PZM motor Shim uses the pins 35/37 and 36/38 so just create 2 variables
Motor35,37
and
Motor36,38
Hello,
thanks a lot for your work ! I’m a french STEM teacher, and after playing with the arduino I tried the Rapsberry.
First I tried it with the PiFace shield, it works fine. This is cool for domotic but when I tried to build a robot with it I had a problem : motor can’t roll back !
So I bought a PiRoCon card, it’s just perfect ! And with ScratchGPIO it’s easier and I’m trying to show it to primary teacher.
But your ScratchGPIOv4 doesn”t work with the PiRoCon, whereas the v3 works fine…
I try to build (it’s just the very beginning) a wiki about my test to help teacher, newbies, use it with pupills : http://tic.technologiescollege.fr
Thanks a lot !
Hello – thanks for the bug report – V4 should work OK now – please try it again 🙂
Simon
Thanks…but I still have the same problem after installation : “./scratchgpio4/scratchgpio4.sh” not found… You have to write Exec=/home/pi/scratchgpio instead of Exec=./scratchgpio
It seems the handlet doesn’t work…no initialisation of the PiRoCon…ScratchGPIO3 work perfectly.
Thanks a lot.
I don’t understand why you have to change the Exec line – it is in excatly the same format as the scratchgpio3 shortcut which works for you 🙁
Can you re-download the latest version as I’ve found one bug that would stop it working on some systems.
Can you try running from LX terminal
cd /home/pi/scratchgpio4
./scratchgpio4.sh
it should launch the handler in a window and then Scratch – you shoudl either see an error or eventually if will say Running
Simon
The Exec line on the v3 isn’t “./scratchgpio/…” but “/home/pi/….” ; I don’t remember if I changed something or if it’s the original one.
Your script “works”, but it seems to never stop on the LX terminal…
However, ScratchGPIO4 works fine with PiRoCon !!! Perfect !
I now have to make documentation and test sonar…
Thanks a lot !
Hi Simon.
I’m using a new GPIO board called the Pibrella at the moment. Is it fairly easy to specify a new AddOn definition, or is that something you need to do?
Just this very second added initial support in V4 🙂
You can use broadcasts red/amber/green on/off outpute-h on/off and recognises ina-d and switch. Also beepxxxx where xxxx is freq in kHz but it’s not HiFi 🙂
When do you think you’ll put that development version up for download? (I’m using Pibrella to teach a bunch of kids on the 7th and I’m scared!!!)
It’s already done. 🙂 I’ve got a stable and dev download now 🙂
Having some problems. First off,I try your simple LED light-up example using pin 11 (by broadcasting pin11high). On ScratchGPIO v3 it works,the LED lights. On v4 though it doesn’t work.
I’m also trying the following in v4:
when [] clicked
set AddOn to pibrella
broadcast redon
Nothing happens. Am I doing something wrong?
Dear Santa Claus,
I use the PiFace on my Rapsberry and the PiRoCon, could you please include the PiFace handler inside an unified hanlder ?
Thanks a lot !
unfortunately, I don’t have a PiFace 🙁
My code was originally the PiFace code but I changed it to just simply control the GPIO pins and then I ended up adding support fro add-on boards in.
Maybe one day the PiFace fairies will lend me one 🙂
Simon
Simon,
I’ve installed V6 as described above; however, upon running ScratchGPIO6alpha I don’t appear to have any control over the GPIO pins (this based on attempting to configuring a pin as output and subsequently issuing a broadcast to set the pin on). Looking at the pins at the command line (gpio readall) indicate that all pins are still set to input. The exact same steps in ScratchGPIO5 works as expected.
Could the issue be related to the fact I’m running a B+?
Alan
Not sure what you mean by atempting to configure a pin as an output as just say pinx on will turn it on – no configuration is needed 🙂 Also no idea what gpio readall is/does 🙂 But anyway – I’ll power up my B+ and have a check – what pin are you trying to turn on?
Simon
Working with Pin11. After firing up scratch V6 I would run the gpio utility (which is part of wiringPi) to look at pin status. It will tell you if pins are configured for input, output or both along with the current state of the pin.
Anyway, part of the problem is I didn’t have smbus installed. Just figured out the location of the scratchgpio6alpha.sh so I can start it up from the command line and see any errors. The script seems to be working ok until it hits pin 29. I’m getting the following output from the script:
setting pin 29 to in with pull up
error reading pin event 29
The channel sent is invalid on a Raspberry Pi
at which point it just grinds (loops) on pins 29 thru 40.
Within Scratch I have crated a variable “Pin11” and can set it to 1 or 0 but there is no voltage change on pin11 itself. I also attempted to broadcast “Pin11high” and “Pin11low” with no luck.
I’m also getting an exception thrown in thread Thread-1:
it looks like it’s coming from line 310 of sgh_GPIOController.py based on the Traceback. The exception ValueError is “The channel sent is invalid on a Raspberry Pi”
Alan
Not sure what I did wrong but downloading a new Wheezy image and writing it over the original sd card image appears to have fixed the problem. Looking forward to making some progress on a Lego Car with my son over the weekend now.
Excellent news 🙂
Hello Simon,
I’m having a play with your ScratchGPIO6 and the Pi2go-lite. I’m up and running using the variable AddOn set to pi2golite .
The motors are running and the front and back LEDs are working fine.
From the sensors I’ve got the values from the left and right IR sensors in ‘if’ statements. Although it is slightly confusing (as when the left and right LEDs turn on the value is ‘off’ in Scratch) they are working.
I’m now trying to use ‘when I receive Triggerpin23’ to do something when the button is pressed on the robot. This doesn’t seem to be working.
Any suggestions on how I can debug this?
Thanks,
Barry
I’ve just been changing my trigger code recently so I’ll power it up on a Pi2GoLite and see what’s happening
BTW you are the very first person to mention using the new Trigger stuff in V6 🙂
Simon
Well, I’ve looked into the code and its got into a bit of a shambles!!!!!
I’m charging my batteries and let you know when I’ve got it back into shape (I was playing with wheel encoders and obviously mucked things about too much)
Simon
Hi
Please try installing the ScratchGPIO6Dev version
http://simplesi.net/scratchgpio-development-testing/
The sensors should report on when LEDs are on – the linefollowers should show up and the switch should produce TriggerSwitch events
Simon
Last weekend I have installed ScratchGPIO 6 and Scratch interface Device on my Raspberry pi which is part of a 4Tronix Initio Ultimate robot. When I have only the motors connected to the Pirocon board, it works without problem. When I connect the IR obstacle sensors tot pin 7 and 11, the Scratch GPIO python scripts hangs on the following line GPIO.setup(pin,GPIO.IN,pull_up_down=GPIO.PUD_UP)
Any suggestions?
Hi Could I ask you to just detail what steps you are going thru to reach the hanging stage?
email me on simplecy at googlemail dot com
Simon
Thank you for this new release! My Scratch was crashing after every GPIO off command. Now with v7 I don’t have any problem taking pins up and down! Thanks.
Hello!
I bought the Unicorn Hat for a workshop with kids next week but with Scratch its freezing again and again. I am using Scratch7 with a Pi3. Any knowledgea about that? Would be great if you could help me.
UNicorn hat needs a lot of power – Pi3 needs a lot of power – so I’d think it was a combination of both of them together.
Turn brightness right down to test – I mean a value of 1 or 2
The display of the unicorn freezes and then I have to restart scratch.
So try using
broadcast bright 1
or
broadcast bright 2
This will reduce power needed
Simon
Also I dont know how to display images on scratch to the hat.
Thank you! Right now I am working with the sense hat and now it is crashing immediately when I am opening scratch in all projects. Additionally. Where do I have to place images if I want to load them?
I Feel like I need to reinstall everything. I didn’t think about the energy issue. Maybe I played around too much with trouble shooting and this IC7 script.
Even If I load the sense hat example scratch crashes immediately . Sense Hat should be fine as it works with Python.
I already debugged several times, problem occurs with all scratchgpios on my rp3. Last week before using unicorn hat everything was fine with sense hat . Simple LEDS with breadboard work.
I found a Little Solution . I have to delete the unicorn addon and create s new Add on again … Now I just Need to figure Out how to display pictures 🙂
Well not Really . Its crashing again
Feeling your pain a bit here
I think NuScratch supports the sensehat natively (or have I got that wrong?)
Can you try that out first (i.e don’t use ScratchGPIO)
I can’t find my unicornhat at moment as in the middle of refurbishing the playroom so everything is piled up in another room 🙁
I am also facing same issue. When we set the Addon to SenseHAT and run the scratch crashes. Tried loading the gpio-scratch example and that also crashes scratch. Please help asap. Thanks
I was trying out Scratch GPIOv8 for receiving a sensor value in python and changing the brightness of an led according to that in Scratch . Using it I am able to send broadcast from python to scratch, but i am not able to start the python program using the following command- ‘broadcast run python test.py’ .Nothing happens when i send this broadcast in Scratch. Also, when i am receiving a variable broadcast from python i.e. a value from some sensor which keeps changing, how do i monitor that in scratch without knowing what to look for.
This feature is new so prob a bug in my code
Could you send me yoru Scratch and your python scripts to test out at my end please?
Simon