How to get values from a lego EV3 Infrared Sensor into scratch

Hi. Apologies for a very basic question, but my kids and I are new to brickPi and scratch :slight_smile:

We’ve connected lego Interactive Servo Motors and a lego EV3 Infrared Sensor into our BrickPi. We’re able to control the servo motors, but not able to get data from the EV3 Infrared Sensor.

Can anyone give us advise/examples on how to get values from a lego EV3 Infrared Sensor into scratch.

Thanks!

Hey ScratchyDad, currently I don’t think we support the EV3 Infrared sensor in BrickPi scratch. I’ll double check. We’re going to plan out a software rework on the BrickPi Scratch modules and I will put this sensor on the list.

Thanks John! It’d be great to know if I can use the IR sensor.

Perhaps I’ll swap it with the ultrasonic one for now - that’s supported isn’t it?

Indeed, the original NXT Ultrasonic sensor is supported.

Hi John,

I recently added support for the EV3 Ultrasonic and Touch sensors in the Python listener for Scratch. I made a pull request in the repo, in case this might be useful for people. I haven’t tried the most recent Raspbian for Robots, but in the one prior to the January one, there BrickPi.py in the BrickPi Scratch folder was old, and needed to be copied across from the Python folder.

The extra script, to allow those EV3 sensors in Scratch, is here https://github.com/jafine/BrickPi_Scratch/blob/master/BrickPiScratch_EV3.py


Jafine

Hey Jafine, I just merged it! https://github.com/DexterInd/BrickPi_Scratch/pull/6

Thanks so much for the contribution. We really appreciate it!