Communication ECA Phase IV Class 2: Programming Basics 20180919

In the second class, we continued talking the main programming blocks in the EV3 software and the hardware communications. The programming blocks include three categories: Action, Flow control, and Sensors. The Action includes all action related blocks such as the motor, motion mode, and sound and light of the brick. The Flow control includes start, delay, loop, and switch blocks. The Sensors include color sensors, ultrasonic sensors, gyroscope sensors, and touch sensors.

The first program we covered was the motor control.

The program starts by a “start” block in the “flow control” category, follows by a “large motor” block in the “action” category, then a “wait” block in the “flow control” category. The differences among three motor control blocks come from the first button, from where we can choose the control mode of the motor. The five control modes are literally intuitive. The second button controls the power input, the number can be both positive and negative, which can make the motor rotate and clockwise contraclockwise.  The third one depends on the choice of the first control mode. For example, in the first “large motor” block, we picked “on for rotations”, power to “50”, and “1”. The block controlled the motor to rotate 1 clockwise circle. The “wait” block is nothing but to control the motor to stop for 1 sec.

The second program we did was the touch sensor.

As the last program, it starts by a “start” block in the “flow control” category, follows by a “wait” block in the “flow control” category, then a “sound” block in the “action” category. The “wait” block is very powerful and can be used to control all sensors by choosing from the first button list. The reason we used a “wait” block instead of the “touch sensor” in the “sensor” category is that the program pipeline needs to be paused until the sensor get triggered after a time delay. Due to the fact that the time is not determined until the sensor gets triggered, thus we cannot use set a determined time as same as the first motor control program. The “sound” block was activated when the touch sensor was triggered and gave a sound “Ouch”, which can be picked in the upper right button list.

Leave a Reply

Your email address will not be published. Required fields are marked *

Play2Learn Education