Knowledge Base

Touch Sensor

A touch sensor is a simple push button that can either be pressed or released.

The EV3 Touch Sensor is no different. It will return a Boolean type value (true or false) depending on its state:

Touch Sensor State Returned Value
Pressed True
Released False

 

 Here is an example code:

In the example above, the until condition refers to the touch sensor state.

The loop will continue until the condition is true, meaning until the touch sensor is pressed.

That is just one way to drive the robot forward until the touch sensor hits an obstacle.

 

 

 

 

م

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Please sign in to leave a comment.

Powered by Zendesk