App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your...
Transcript of App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your...
![Page 1: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/1.jpg)
![Page 2: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/2.jpg)
App Inventor
meets NXT
![Page 3: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/3.jpg)
Pre-day Questionnaires
![Page 4: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/4.jpg)
About Technocamps We go around schools like yours and show you lots of interesting stuff!
We also do things we call “bootcamps” during holidays!
![Page 5: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/5.jpg)
What is a STEM subject? Science
Technology
Engineering
Maths
They all link with each other!
![Page 6: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/6.jpg)
What are Robots?
![Page 7: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/7.jpg)
Task Draw a Robot. What will it look like? What will it do? How will you interact with it?
![Page 8: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/8.jpg)
Here is Tom’s Robot
What do you think it does? Now let’s see yours…
![Page 9: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/9.jpg)
Robots This is the iCub, a robot used in research to simulate infant learning.
![Page 10: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/10.jpg)
Robots!
Sometimes it is better to have machinery performing the dangerous
jobs.
This is common in the industry.
Machines may be used instead of humans if a repetitive job is required
e.g. assembly lines,
![Page 11: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/11.jpg)
Robots!
In the 80s there was a program called “Knight Rider”. This car was features in
the program called “Kit”.
The car was designed to talk and interact with the driver and to think
like a human.
Although this is science-fiction, our cars today are pretty smart too!
![Page 12: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/12.jpg)
Robots! Idris is a research robot, sent to complex
environments where it drives around on its own.
Usually use to research the environment.
![Page 13: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/13.jpg)
Robots!
This is BeagleB, similar to Idris but more suitable for the sea.
It is used for example to measure
water quality or listen to dolphins as they communicate to one another.
![Page 14: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/14.jpg)
Robots
Do you think a washing machine is a robot?
Why?
Why not?
Discuss as a group.
![Page 15: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/15.jpg)
Robots… … are devices. … are programmable. …can sense their environment. …can act on and within their environment.
![Page 16: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/16.jpg)
App Inventor
![Page 17: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/17.jpg)
The interface: Design
![Page 18: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/18.jpg)
The interface: Develop
![Page 19: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/19.jpg)
App Inventor and NXT Robots
![Page 20: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/20.jpg)
Buttons
Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop
![Page 21: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/21.jpg)
Events Button.click is an event. Event loop – Run through checking for events. Blocks correspond to the events. You can use these event blocks to control what happens when an event happens. You can use these events to make your robot move..
![Page 22: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/22.jpg)
Experiment Before we move on, let’s play with some negative numbers. • Change the numbers for the power that you are using when you go forward,
back, left and right to a negative number.. • What happens? • What do negative numbers mean?
• Also, what is the slowest that our robot can move? Or the minimum speed?
![Page 23: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/23.jpg)
Better Driving How do “normal” vehicles drive? How do you think our robots should drive? Acceleration and Deceleration. Better Turning? Differential Drive.
![Page 24: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/24.jpg)
How can we do this? We need to: • Control each motor separately:
• Use 2 NXT drives, add one now • Store the speed we are moving, and how much we want to turn:
• Using variables, create some
• Change these values with our buttons: • Use a combination of the variables to get a new speed • A bit of an explanation first
![Page 25: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/25.jpg)
Movement Speed +
Speed -
Turn + Turn -
![Page 26: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/26.jpg)
Clock A clock allows us to keep changing how we drive. It can be found the the components menu. Use a clock to keep adjusting the motors to the values of speed and turn, using the timer event in the Blocks Editor. But what values do we give the motors?
![Page 27: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/27.jpg)
What if we are not moving? If we are not moving or:
speed = 0 turn = 0
Then you want to stop moving both motors. To check this we use a conditional statement, also known as an “IF statement”. IF *this* test is true, then do *this*, else do *this*…
![Page 28: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/28.jpg)
What if we are not moving? So if we are not moving, then we want to test the following: If “speed = 0 and turn = 0” Then
Stop Left motor Stop Right motor
Else…
![Page 29: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/29.jpg)
What if we are not moving? If we are moving forward, then is the speed of our robot positive or negative?
![Page 30: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/30.jpg)
What if we are not moving? If we are moving forward, then is the speed of our robot positive or negative? It has to be positive so we can test. If speed > 0 (is greater than) Then
Move left motor forward Move right motor forward
But what about the turn?
![Page 31: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/31.jpg)
Task Speed = 30 Turn = 20 MinSpeed = 50 Left Motor = 0 Right Motor = 0
![Page 32: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/32.jpg)
Task Speed = 30 Turn = 20 MinSpeed = 50 Left Motor = 0 Right Motor = 0 + MinSpeed +MinSpeed
![Page 33: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/33.jpg)
Task Speed = 30 Turn = 20 MinSpeed = 50 Left Motor = 0 Right Motor = 0 + MinSpeed + MinSpeed + Speed + Speed Positive turn means what way?
![Page 34: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/34.jpg)
Task Speed = 30 Turn = 20 MinSpeed = 50 Left Motor = 0 Right Motor = 0 + MinSpeed + MinSpeed + Speed + Speed + Turn - Turn MinSpeed + Speed + Turn MinSpeed + Speed - Turn Put this inside your conditional.
![Page 35: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/35.jpg)
Backwards If we are not moving forward, we must be going backwards. Backwards is a little more complicated because Speed will be negative. So if you go backwards with a speed of -40 what direction are you moving?
![Page 36: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/36.jpg)
Backwards If we are not moving forward, we must be going backwards. Backwards is a little more complicated because Speed will be negative. So if you go backwards with a speed of -40 what direction are you moving?
FORWARDS
You can either use move forward with a minus speed or you can do: 0 – speed
This will make your speed positive because - - = +
![Page 37: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/37.jpg)
Backwards Now you have decided how you want to do it, see if you can move backward by going back through some of the maths we did earlier. Try numbers like: Speed = - 70 MinSpeed = 50 Turn = 10
![Page 38: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/38.jpg)
If you have finished… Let the delivery assistants know if you have finished and they can provide some sensors. See if you can get your robots to become “Autonomous” – so they move on their own. Make sure you complete all the required documentation! You can take the TOP TIPS home with you. Make a note of the following web address if you wish to make Android Applications at home:
http://beta.appinventor.mit.edu
![Page 39: App Inventor · App Inventor and NXT Robots . Buttons Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop . Events Button.click](https://reader033.fdocuments.us/reader033/viewer/2022042808/5f868b868ed46b5bd0652702/html5/thumbnails/39.jpg)
Don’t forget to save your work!
All of our software is OPEN-SOURCE (Free and available to download)
It can all be found on our Technocamps website:
www.technocamps.com