scratchInterface Python with MIT Scratch | |
Download |
scratch Ranking & Summary
Advertisement
- License:
- MIT/X Consortium Lic...
- Price:
- FREE
- Publisher Name:
- Ben Croston
- Publisher web site:
- http://croston.org
scratch Tags
scratch Description
scratch is a Python module that enables communication between Python and Scratch using the remote sensors feature of Scratch.Remember to enable remote sensors in Scratch! To do this:1. Go to Sensing2. Right-click on a 'sensor value'3. Select 'enable remote sensor connections'Example usage:import scratchs = scratch.Scratch()# to make a broadcast to scratchs.broadcast("from python")# to receive an update from scratchmessage = s.receive()# blocks until an update is received# message returned as {'broadcast': [], 'sensor-update': {'scratchvar': '64'}}# or {'broadcast': , 'sensor-update': {}}# where scratchvar is the name of a variable in scratch# and 'from scratch' is the name of a scratch broadcast# send sensor updates to scratchdata = {}data = 123for data in range(60): s.sensorupdate(data)Product's homepage
scratch Related Software