0

Actually One of my friend don't know much about scripting. But he have good creativity and logical skill. He want to use scratch for generating a script which can turn on LEDs connected to GPIO pins and generate some pattern on LEDs. So How can one use scratch for this application. And also can we use wifi, bluetooth in it. That means send some data to device connected on wifi network.

2
  • Why doesn't your friend ask the question?
    – Darth Vader
    Jul 25 '16 at 9:36
  • cause he is too young to learn scripting languages and ask questions on stack exchange.
    – Ravi C
    Jul 25 '16 at 10:14
1

For the controlling of LEDs and such through the GPIO, check out ScratchGPIO. Scratch itself has network broadcasting capabilities out of the box, through a feature called Remote Sensor Connections. All you need to do is right-click on the () Sensor Value block in the Sensing section to enable this feature in your program.

enter image description here

Once enabled, your Scratch program starts sending all Broadcast messages and any change in variable value onto your Local Area Network on port 42001. You can send messages to this port using the Remote Sensor Protocol. From experience I can tell you that implementing this is not difficult and easily achievable by someone with moderate programming skills.

UPDATE: Actually, according to this article, the latest images of Raspbian now include ScratchGPIO-like code right in the basic installation of Scratch, so no more need to download and install ScratchGPIO separately.

NOTE: All of the above is valid for Scratch 1.4 (provided with the rPi). Scratch 2.0 works differently.

2
  • Hi Phil. I think Rpi3 have v2.0. What may be differences there. If you used v2.0. can you please share that info too? Thanx..
    – Ravi C
    Jul 25 '16 at 10:40
  • I don't think 2.0 is used on the Pi yet, whether you have a 3.0 or not (3.0 is really the same as the rPi2 with added networking features). Did find a link indicating you no longer need ScratchGPIO. Will update my answer.
    – Phil B.
    Jul 25 '16 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.