Max:Bot 2: Smart Max:Bot
userhead
NPC 2020-04-03 17:36:18

You may now possess a sense of fulfilment because Max:Bot can go to anywhere you want it to go. But have you feel a little bit more frustrated that there always has something to block its way, like a desk or a closet. Don’t worry, in this chapter, we will teach Max:Bot how to avoid these obstacles.   

projectImage

🔸 Goals:


1. How to use the Digital Crash Sensor? 

2. How to use the “if then” function? 

3. Diagram aided programming  


🔸 Digital Modules

projectImage

💜 2.1 The “shy” Max:Bot 


Sometimes, when being touched, Max:Bot will become cute and shy. Yes, he can feel you.

projectImage

🔸 Key information

projectImage

🔸 Program


(1) Start a new project and name it as “the shy Max:Bot ” 


(2) Find the “if then” function from “Logic” in the function area and place it into the “forever” loop. 

projectImage

If the logic statement to the right side of “if” is met, the function to the right of "then" should be executed, whereas the next function should be executed if the logic statement is not met. This is an either or thing.


(3) The “=” operator lies in the “Logic”.

projectImage

Besides “=”, there are many other operators, like “>”, “

projectImage

(4) How to control the digital crash sensor? 


Anytime when Max:Bot is touched by others, he will immediately become a shy robot. Why he becomes so sensitive? Because we have connected digital crash sensors to it. 

 In this part, the “digital read” function will be applied to determine whether the digital crash sensors are touched or not. Connect one of the digital crash sensors to Pin13.    

projectImage

Do you have any idea about what response Max:Bot is going to make? The table below can be used as a reference. 

projectImage

(5) Make the heart beat 


 Once has being touched by others, Max:Bot will immediately become shy and with his heart speeds up. But how can we make his heart really beat? The function “show icon” does the job. You can find it in “Basic” of the function area. 

projectImage

As has shown in below image that there is a micro triangle lies at the top right of the “show icon”. Click it and choose the smaller heart icon. 

projectImage

To make it more like a real heartbeat, we need to add the “pause” function and another bigger heart icon. By putting together all the functions listed above, we will have the following program. 

projectImage

(6) Download the program to Max:Bot . 


Now when you touch Max:Bot , he will then show you his heartbeat. What a cute robot! 

projectImage

🔸 Exercise


Needless to say, Max:Bot is a very nice companion. We have already created his heartbeat. Now we want to make him a smile face when he is untouched. 


We will use the “if else” function to make him smile. You can also find it in “Logic” of the function area. 

projectImage

Compared with the “if then”, there is an additional “else” in the “if else”. What is it? 


As we have learnt in previous part that, in the “if then” function, If the logic statement to the right side of “if” is met, the function to the right of "then" should be executed, whereas the next function should be executed if the logic statement is not met.  


While in the “if else” function, if the logic statement on the right side of “if” is not met, the statement to the right of “else” should be executed.


💜 2.2 escape the maze


Since the digital crash sensor grows Max:Bot to a sensory robot, what if we place him in a maze? Will he himself find a way out? 

projectImage

🔸 Key information

projectImage

🔸 Program


(1) Start a new program and name it as “escape the maze” 


(2) Help Max:Bot to escape the maze 

Before programming, we should first get to know what Max:Bot would do for avoiding obstacles. 

If the left digital crash sensor is touched, Max:Bot will then turn to the right; 

If the right digital crash sensor is touched, Max:Bot will then turn to the left. 

The diagram below can be taking as a guidance: 

projectImage
projectImage

(3) Some above learnt programs will be combined in this part to help 


Max:Bot escape the maze. Such as: turn left, turn right, go straight, etc. By putting all the programs mentioned above together, we have the final program as below: 

Please note: Different batteries output different voltages. So the value below in the “pause” function is just used for a reference. You have to try and adjust them based on the actual situation. 

projectImage

🔸 Exercise


Max:Bot , a really fast learner, now has made another step forward! Can you remember the “heartbeat” we made for him? How about to make him show us his direction when he is ready to turn. 


💡Tips: You may need the help of the “show leds” function.     

projectImage
License
1
All Rights
Reserved
[[i.text]]
licensBg
0
0
COMMENTS ([[commentTotla]])
[[c.user_name]] [[c.create_time]]
[[c.parent_comment.count]]
[[c.comment_content]]
userhead
NPC
Joined 2019-12-26
M-point M-point 114
Makelogs Makelogs 6
Affiliate
Related Products
X[[p.num]] [[p.name]]