Getting IPad movement sensors information into Scratch

Scratch can pick up information from other Scratch type programs running on other devices.

Some of the more interesting information are movement sensors on the IPad.

Setup IPad

Install Pyonkee (a Scratch clone) on the IPad. Once this is done and Pyonkee is running, enable the motion sensors from the Edit menu (Start Sensing).

If you click on the little black arrow on the 2nd last Sensing block, you will see that you now have a access to a lot of IPad sensors such as roll and pitch (how much the IPad is tilted left/right and forward/backward)

To s2015-07-22 17.45.34end,say, the roll and pitch information, you need to create a little script on the IPad to update some variables with the roll and pitch values.

Now, click on the little mesh symbol next to File and select Join Mesh.  You now need to find out the IP address of the other computer you want to send the information to.

If you now press the Green Flag on your Ipad – it should start sending changes to the roll and pitch variables across to your computer.

Set up Computer

On your computer (any one -Windows/Mac/Linux/RaspberryPi etc) run Scratch and right-click the last block in the sensing section and select Enable Remote Sensor Connections.

Changes to the roll and pitch variables on your IPad will now appear as sensors on your computer.  Simply click on the littel back arrow on the 2nd last block in the Sensing section and they should be visible

Have fun using you IPad as a wireless controller.



You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *