CodeShield is an affordable hardware board that sits on top of an Arduino microcontroller and provides the follwoing sensors: photocell, thermistor, Hall effect sensor, button switch, slide switch and rotary encoder. It also has acutators on board: a relay, a piezo device, an RGB LED, a white LED, and a servo motor. I have created a Scratch 2.0 hardware extension that allows a Scratch 2.0 program to monitor and control all of these elements. If you would like to see it in action check out this video: http://www.youtube.com/watch?v=vdmDf9VvPUs
Want to know how all this works? Here is a link to the code: https://github.com/MrYsLab/CodeShield_Scratch_Extension
Although the software is specific to the CodeShield, it is easily adpated to work with Scratch and any Arduino based project.