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 BrickPiScratch.py?

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 https://github.com/DexterInd/BrickPi_Scratch/blob/master/BrickPiScratch.py 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 https://github.com/DexterInd/BrickPi_Python/blob/master/Sensor_Examples/LEGO-Encoder_Example.py#L26 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.
-Karan