Touch Sensor
-> The touch sensor in EV3 is a small device that detects physical contact, like when you push a button.
-> The touch sensor helping robots interact with the world around them and making them smarter and safer!
Sensors in EV3 are very important because they help the robot "see" and "feel" its surroundings in order for EV3 to make smart decisions based on what it senses.
There are 5 type of sensors:
-> The touch sensor in EV3 is a small device that detects physical contact, like when you push a button.
-> The touch sensor helping robots interact with the world around them and making them smarter and safer!
If it shows zero (0), it's released.
If it shows one (1), it's pressed.
1- Press
2- Robot begin moving
1- Wait [robot don't do anything] Until [Touch sensor is "pressed"]
2- Robot moves BACKWARD for 500 degrees at the speed of 20%.
Notice that it does the opposite from the last one
1- Robot "start moving"
2- stop when sensor is "pressed"
1- Wait [wheels move backward at speed of 20% repeatedly] Until [touch sensor is "pressed"]
2- Stop moving.
Notice that there are 2 "set movement motor" blocks
This is the "set movement motor"
For Repeat Until "pressed"
It's better to put one of this pink block AT THE BEGINNING
This is much more simple (that's what programmers do, make the codes more simple).
1- Repeat [Robot make a big turn toward left]
2- Until [Touch sensor is "pressed"]
3- Robot moves forward for 400 degrees at the speed of 50%.
1- Repeat Robot moves backward forever at the speed of 40%
2- Until [Touch sensor is "pressed"]
3- Must add the "stop moving" since we put "start moving" block
4- Move forward for 150 degrees at speed of 30%
5- Make a left spin turn of 300 degrees at the speed of 30%.
6- Move forward for 300 degrees at speed of 30%. Toward the yellow container
7- Motor A move clockwise (up) 200 degrees at the speed of 20%
Purpose: Robot lift the yellow container
Hint:
-> Use "forever" loop
-> The degree I used it's 150. The speed is 50%.
-> Don't use too much degree, or the motor might be stuck.
1- When touch sensor is [pressed], motor A go 150 degrees clockwise (up).
2- When touch sensor is [released], motor A go 150 degrees counterclockwise (down).
-> Notice that I need wait until block. But you can explore and use loops inside loop (I might talk about this later on).