Polling sensors

Learn this with friends

ScienceElectrical engineering1:175 check-ins

About this video

The presenter shows how to read a sensor's live value inside the robotics software. Selecting the correct port and watching the real-time reading lets you check that a sensor is working, such as a rotation sensor measuring degrees. If readings do not appear, check the port and connection, then save, close, and reopen the software.

You'll be able to

  • open a sensor's live reading window and find its current value
  • zero a sensor with Reset and measure how far a motor has turned
  • troubleshoot a sensor that is not updating by checking the port and restarting the software

Key words

Live reading
The current value a sensor reports, updated in real time inside the software.
Port
The physical socket on the hub where a motor or sensor is connected, and which must be selected in the software.
Reset
A control that sets the sensor's current reading to zero so later movement can be measured from that point.
Rotation sensor
A sensor that reports how many degrees a motor has turned.
Transcript

When configuring any sensor, it's important to understand how to poll them in real time, which means you grab their current reading and see what it is right inside the software. For example, I could grab any sensor, but I have the rotation sensor here. And now down in the settings, when I click on it and I make sure I select the correct port that the motor is plugged into, over on the left is the live reading window, and for every sensor you will have this.

And in this case, it says rotation sensor, and there's a little box, which in real time as I move the motor, it updates with the current reading, which is the number of degrees of rotation. I position the motor in some state, and I can click Reset, which zeros the reading.

And then I could rotate my motor a certain amount, and then I can check this window to see how many degrees it has rotated. And you can do this for any sensor-- your current light reading, sound reading, et cetera. And if you're not getting a reading in real time and you've double checked your port and connection, what I do is save everything, close the software, and reopen it, and sometimes that will fix the problem.

Video © Khan Academy, used under CC BY-NC-SA. Watch on Khan Academy. Puzzicle is not affiliated with Khan Academy.