Tuesday 1 July 2014

GPIO Marshmallows and Jelly Babies

Attempt 1: Using Marshmallow as a Button

So 9:30 at night may not have been the best time to start fiddling with my Raspberry Pi, and especially as I decided to have a go at making a marshmallow become a button but throwing caution to the wind I pressed on. After ransacking the house for marshmallows and a paper clip I was ready to start, I think it might be worthwhile to use bigger marshmallows next time as the little ones squashed too easily. See photos for 'used' marshmallows - there were only so many that I could eat before feeling ill.



After successfully making the marshmallow register as a button when I squashed it, I decided to press on and try to add the keyboard in. This proved to be a little more complicated when I tried to test it all together as the structure of the marshmallow was just not up to the challenge. 



I finally dispensed with the marshmallow for the time being so I could concentrate on getting the program to work correctly. After a quick test I was ready to move onto creating the game in ScratchGPIO, quickly picking a sprite (as time was marching on and my eyes are already itching like crazy from hayfever.) I pulled the code together for a final test before calling it a night.



It worked, I am very happy with my quick journey into using GPIO with some everyday items, although, who knew it would be so hard to find a paper clip in the house?


Attempt 2: Jelly Baby Screams

Feeling pleased with my marshmallow attempt last night I decided to have a go at the screaming jelly babies. After picking up some jelly babies on the way to work, I was ready for the challenge, downloading the sound was easy enough but getting my headphones to work was a challenge that I just didn't have the time to battle with (thinking that using a USB speaker would be more productive!). So moving on I went and entered the code, after sticking my poor jelly baby with the paper clips (and having to listen to another teacher telling me it was a mean thing to do to a jelly baby) I was ready.


Ran the program, and there was an error - nooooooooooooooooooooooooooooooo, I have typed it in correctly! Run again, nooooooooooooooooooooooo, still the same error. Check the pins - yes, they are in the right place. Open code, compare.......wait a minute.....oops, missed a line of code, that would explain it. Run program again......success, my jelly baby may not be screaming but it is telling me to have a nice day. 

I rewarded the jelly baby by eating it.


Hmm, what to do next? My sixth formers are looking like the best guinea pigs to test all these things out!

No comments:

Post a Comment