Maker Education Manipulator A guest education robot
Lesson 9 Unplug the charger at the setting time
CONTENTS I. Introduction of subject II. Explanation of knowledge points CONTENTS III. Skills competition IV. Classroom summary
I. Introduction of subject
Alarm clock 1 1
Target task 2
II. Explanation of knowledge points
Unplug the charger at the setting time Function breakdown Compared with the previous design of the program, what is the biggest characteristic of the program to unplug the charger at the setting time? 1 1 Unplug the charger at the setting time Set the time Unplug the charger
2 Achievement of time setting How to achieve the function of time setting? Current time Start time Setting time < + ?
Program flow chart Acquire the system time and set it as the start time Set the fixed time Acquire the current time Judge whether the current time is the setting time Unplug the charger No 1 3 Yes
Function achievement: unplug the charger 4
1 5 Function achievement: time setting Step 1: acquire the system time Step 2: view the format
1 5 + < ? Function achievement: time setting Step 3: time relationship 1 Step 4: logic judgment 5 Step 5: repeat the operation “When” cycle “Till” cycle Setting time Current time Start time + < ? Acquire the current time which is reflected in the program running process in a real-time manner Record the program start time, and assign a value through the acquired time at the beginning of the program. The setting time is expressed in seconds.
Example of comparing time program with “when” cycle Function achievement: time setting Example of comparing time program with “when” cycle 1 5
Function achievement: view the implementation process 6
III. Skills competition
It is time to operate by yourself!
I control my manipulator Operation purpose: Blockly program advancement Operation task: the manipulator performs the function of unplugging the charger automatically
Program example
IV. Classroom summary
Summary What have we learned in this lesson? - Achieve the implementation of a certain task by the manipulator using the graphical programming software - Acquisition and logic judgment of the learning system time, the function and operation method of “When” cycle and “Till” cycle structure, printing module, etc.; - Review the definition and call of the function, the definition and assignment of variables, mathematical operation, the movement mode of the manipulator, time delay and other functional modules.
After-class thinking How to write the statements when “Till type cycle structure” is used to achieve the judgment of time setting?
THANK YOU