Developing with Kinect2Scratch

Developing with Kinect2Scratch
Setup
1. You should use a fast PC and you must use Windows 7 or Windows 8.
2. Download the correct drivers:
a. If your Kinect is a Kinect for Windows, download and install the MS Kinect Runtime v1.6.
b. If your Kinect is a Kinect for XBox, download and install the MS Kinect SDK v1.6
c. You must have a powered Kinect (one with its own electricity plug)
d. Plug your Kinect into the electricity socket
e. Plug the USB lead on the Kinect into your PC
i. Try to use a USB section with no other device in use (like webcam)
ii. USB 2.0 or better may be required
3. Run Kinect2Scratch and Scratch.
4. In Scratch
a. Start a new project (if you weren't already using Scratch, it will probably be a new project already)
b. Click on Sensing
c. Right click on <Slider Sensor Value> Block
d. Select 'enable remove sensor connections' (see fig 1)
5. In Kinect2Scratch:
a. If you want 3D and 2 Player mode, click Configure Skeleton and tick them on
b. Click Launch Kinect, wait for video to appear
c. Click Connect to Scratch
d. Adjust your Kinect so that you can easily stand in front of your Kinect
e. Stand in front of your Kinect, it must see your whole body
i. You need lots of room, clear your furniture away!
ii. Only one person at a time (later add another)
iii. No direct sunlight!
f. If the left hand video shows your shape in red, it has detected you
g. Now go back to Scratch and follow the next section
Programming Kinect in Scratch
1. Assuming you followed the steps above:
a. Click Sensing
b. In the <<slider> sensor value> block, click on the small down arrow beside slider
c. If you see a long list of values like this: head_x HandRight_y etc. then it is working perfectly
d. Now write this small program to test (fig 2):
i. When Green Flag Clicked
ii. Forever
1. Go to X: mouse x Y: mouse y
e. Run the program and move your mouse around the stage
f. Does the Cat follow the mouse?
g. Now the Kinect bit, replace both the mouse x and mouse y sensor blocks with HandRight_x and
HandRight_y sensor blocks (fig 3).
h. Now run the program, stand in front of your Kinect and wave your hand
Have fun, there are much more details in Kinect Hacks, an O'Reilly book due out end of November 2012. Email
me if you have any questions: stephen@saorog.com
Fig 1: Switch on Scratch to receive sensor data
Fig 2: A sample Scratch program
Fig 3: A sample Kinect2Scratch program