Programming sensors on ultimate 2.0 (megapi)


All my programming has been done with mblock and in online mode.
I load multiple projects that control different motors and the gripper and they all work.

I have not been able to get any sensor to work. I have tried the ultrasonic, the PIR motion sensor and even the LED sensor.
For the ultrasonic, the robot is approx. 25cm from a wall and the only reading I get is 400.
For the motion sensor, it does not record any motion.
For the LED sensor, no color is displayed.

ultrasonic sensor test script

What I am doing wrong? Should there be an LED lit on the sensor?
I have tried multiple ports.
note: “upgrade firmware” and “reset default program” make no difference.
The batteries are good as I can run all the motor programs.


I removed all the electronics and modules on the megapi and then re-installed.
The red led came on each sensor and my test programs worked.