Scratch and the motor encoders in the motors


How can I access these in the Scratch program? Can I use them in control statements ? Can I just get the live readings to display? Can I write a python subroutine to pass back the info in the


Reading the encoders is not implemented right now in the scratch software. If you want to use that, you’ll have to implement it in the python communicator. The communicator is here and Line 139 to 222 implement how the communicator interprets and runs the commands. To send data to back to the scratch, you’ll have to use the sensorupdate function, similar to the one in line 152. So, you can basically implement this example in scratch, so that the encoder value is fetched and sent to scratch when it gets the command from the Scratch.

Do let us know if this works for you.