Ultrasonic Sensor Boards
If you connect a cheap 4 pin Ultrasonic Module as per this diagram, then you can safely connect it to your Pi BUT ONLY WITH THE RESISTORS IN PLACE only need one spare GPIO pin to trigger it and receive the returned pulse
So now you simply use it (assuming connected to pin 23)
Use followed by a wait 1 and then just use the sensor item sonar23 to get the distance measured in cm. Any pin can be used for this purpose and if you had several of them you could broadcast each of them in turn.
Alternatively, you can use this syntax which will tell your Raspberry Pi to continuously do a distance check every 1 second and update sensor item Ultra8 with the results without any further need to do another broadcast
This board makes it very easy to control Motors and Servos without any extra hardware as well as giving you the ability to switch your Raspberry Pi on and off and power it from AA batteries.
See https://cymplecy.wordpress.com/2013/08/12/scratch-gpio-piglow-support/ for full support info
This really cheap and useful board is an alternative to @drogon LadderBoard.
It has 6 LEDs, a switch and a buzzer
To use it just set the AddOn variable to Berry and then you have easy methods of accessing it
[Led1..6] [On/Off/High/Low] e.g broadcast Led1On will make first red led light up
[All] [On/Off/High/Low] e.g broadcast AllOn will make all LEDs and the buzzer come on.
[Buzzer] ]On/Off/High/Low] e.g broadcast BuzzerOn
You can use variables instead e.g Set Led1 On will turn on 1st LED
And also use Power1..6 (values 0-100) variables to vary the brightness as
There is only one sensor value returned and that is called switch (1 if not pressed – 0 if pressed)
This board is a complete robotics controller for your Raspberry Pi based mobile robot.