"Event" blocks in EV3 are like special buttons that you can program to make your robot do specific actions when certain events happen. They add a lot of fun and interactivity to your robot's behavior!
-> "When the program begins": it's the most common used block.
-> We can also use the sensors to start the program, as long as it meet the condition.
-> The broadcast block are to send message from one code to the other.
Notice that the video/image is x2 speed.
1- The robot wait for you press "center" buttom
2-Robot move forward 300 degrees at the speed of 30%
3- Motor A move 200 degrees clockwise at the speed of 20%
4-Robot move forward 400 degrees at the speed of 30%
5- Motor A move 100 degrees counter-clockwise at the speed of 20%
6-Robot move backward 300 degrees at the speed of 30%
7- Stop and Exit program
1- The robot wait for you press "left" buttom
2-Robot move forward 1000 degrees, left wheel at the speed of -60% and right wheel at the speed of 0%
-> Robot make a pivot turn of 1000 degrees.
1- The robot wait for ultrasonic sensor sense "less than 15cm"
2-Robot move forward 1000 degrees, left wheel at the speed of -60% and right wheel at the speed of -20%
-> Robot make a pivot turn of 1000 degrees.
1- The robot wait until color sensor read "green"
2- Robot say "Green". And then say "Go"
3-Robot "starts moving" backward at the speed of 40%
4- Until color sensor read "red"
5- Robot stop moving
6- Robot say "Red". And then say "Stop"
7- Stop and Exit program
1- The robot wait until touch sensor is "pressed"
2- Robot display robot "smile" face for 1 second
3- Robot display robot "wink" face for 1 second
4- Robot display robot "smile" face for 1 second
5- Robot display robot "wink" face for 1 second
6- Stop and Exit program
Remember this code from Control "wait" block?
We are going to use broadcast.
Notice: you can change the name of the broadcast.
-> Broadcast named "broadcast1" is Motor A moves clockwise of 250 degrees at the speed of 75%
1- Robot move 450 degreees forward at the speed of 50%
2- Robot wait for 1 second
3- Code broadcast receive message called "broadcast1"
which it's Motor A moves clockwise of 250 degrees at the speed of 75%
I want you to use:
-> Event for gyro Sensor block. Robot move toward the left
-> "Reset angle" block
-> Wait for 1 second
-> Stop and exit program
-> Speed is 50% and robot move forward for 500 degrees.
-> The angle is 45 degrees
Notice that you need to spin a bit the robot to the left, so that the gyro count 45 degrees.
If it didn't work, it might be because of the inequality symbol.