Deutsch English |
YOU LEARN HERE... |
how you can use touch sensors to detect obstacles and react accordingly. |
HOW DOES A TOUCH SENSOR WORK |
|
|
https://www.tinkercad.com/things/0bfM0UhJQOk (bumper) |
EXAMPLES |
Program: from callibot import * forward() repeat: ts = tsValue() if ts == 1: backward() delay(1500) left() delay(550) forward() delay(100)
Program: from callibot import * setSpeed(30) forward() repeat: tsL = tsLeftValue() tsR = tsRightValue() if tsL == 1: backward() delay(250) right() delay(200) forward() elif tsR == 1: backward() delay(250) left() delay(200) forward() delay(100) |
REMEMBER... |
The touch sensors can only return two values: 1 if the sensor was pressed, otherwise 0. There are three functions available to you for querying the sensor values:
|
TO SOLVE BY YOURSELF |
|
|