Difference between revisions of "Microbit Trainer Training"
From Wikicliki
(→Scoreboard) |
(→More resources for Microbits) |
||
(31 intermediate revisions by the same user not shown) | |||
Line 35: | Line 35: | ||
== Inputs == | == Inputs == | ||
+ | === Buttons === | ||
'''Step 1''' | '''Step 1''' | ||
Line 43: | Line 44: | ||
[[File:microbitexample_2.png|800px]] | [[File:microbitexample_2.png|800px]] | ||
+ | === Shaking and Tilting === | ||
'''Step 3''' | '''Step 3''' | ||
[[File:microbitexample_3.png|800px]] | [[File:microbitexample_3.png|800px]] | ||
+ | === Touching the pins === | ||
'''Step 4''' | '''Step 4''' | ||
Line 62: | Line 65: | ||
[[File:setvariable0.png|800px]] | [[File:setvariable0.png|800px]] | ||
+ | |||
+ | This only changes the variable, but doesn't show it. | ||
Something is missing here. ask the class to figure out how to "show" the number. | Something is missing here. ask the class to figure out how to "show" the number. | ||
Line 105: | Line 110: | ||
[[File:keepscore.png|800px]] | [[File:keepscore.png|800px]] | ||
+ | |||
+ | |||
+ | == External Sensors == | ||
+ | |||
+ | * You can connect it to P0, P1, P2 with crocodile clips | ||
+ | * When we read sensor info, we tend to want to do it forever | ||
+ | |||
+ | == Compass == | ||
+ | * Must be calibrated | ||
+ | |||
+ | [[File:microbitcompass1.jpg|800px]] | ||
+ | |||
+ | [[File:microbitcompass2.png|800px]] | ||
+ | |||
+ | [[File:microbitcompass3calibrate.jpg|400px]] [[File:microbitcompass4calibrate.jpg|400px]] | ||
+ | |||
+ | == Bluetooth == | ||
+ | |||
+ | [[File:bluetoothmicrobit.png|800px]] | ||
+ | |||
+ | == BoB Breakout Board == | ||
+ | |||
+ | [[File:BOBmicrobit_1.jpg|800px]] | ||
+ | |||
+ | [[File:BOBmicrobit_2.jpg|800px]] | ||
+ | |||
+ | * LEDs on the Microbit should be facing you/up when you insert it in. | ||
+ | * You can connect up to 16 components. | ||
+ | * You can connect more power and toggle the 3.3V and 5V switch | ||
+ | |||
+ | === Speaker === | ||
+ | |||
+ | * Connect the piezo buzzer to P0 | ||
+ | |||
+ | * https://www.microbit.co.uk/musicfest/that-bass | ||
+ | |||
+ | [[File:BOBmicrobitsound.png|400px]] | ||
+ | |||
+ | [[File:BOBmicrobitsound1.png|800px]] | ||
+ | |||
+ | === Types of I/O === | ||
+ | |||
+ | * Add Potentiometer | ||
+ | * Add LED | ||
+ | |||
+ | * For this exercise, use pins 0, 1, 2. Note that for pins 4-10 the power is shared with the led and the LED on the board may show some effects. | ||
+ | |||
+ | [[File:PotSpeaker.png|800px]] | ||
+ | |||
+ | === Burglar Alarm === | ||
+ | |||
+ | [[File:AlarmMicrobit0.png]] | ||
+ | |||
+ | [[File:AlarmMicrobit1.png|800px]] | ||
+ | |||
+ | [[File:AlarmMicrobitYes.jpg|800px]] | ||
+ | [[File:AlarmMicrobitNo.jpg|800px]] | ||
+ | |||
+ | === Add Packages === | ||
+ | |||
+ | [[File:addpackagemicrobit.png|800px]] | ||
+ | |||
+ | [[File:addpackagemicrobit2.png|400px]] | ||
+ | |||
+ | * Everytime you make a new project you'll need to re-add in the packages. You are only adding to that specific project each time. | ||
+ | * Use this version to generate items with the packages already loaded: http://tk.sg/pxt | ||
+ | |||
+ | [[File:addpackagemicrobit3.png|400px]] | ||
+ | [[File:addpackagemicrobit4.png|800px]] | ||
+ | |||
+ | == Scissors Paper Stone == | ||
+ | |||
+ | * Example code: http://tinyurl.com/spsmbcode / https://makecode.microbit.org/66784-01030-67474-24367 | ||
+ | |||
+ | [[File:sps1.png|800px]] | ||
+ | |||
+ | [[File:sps2.png|800px]] | ||
+ | |||
+ | [[File:sps3.png]] | ||
+ | |||
+ | == More resources for Microbits== | ||
+ | |||
+ | [[File:microbitprojects1.png|800px]] | ||
+ | |||
+ | * Click on PROJECTS to see more guided tutorials: https://makecode.microbit.org/ | ||
+ | * Tinkercademy's curated store: https://gethacking.com/ / https://gethacking.com/collections/microbit | ||
+ | * IMDA's Microbit website with projects: https://www.imda.gov.sg/digitalmaker / https://www.imda.gov.sg/digitalmaker/make | ||
+ | * BBC's Microbit Project page: https://microbit.org/ideas/ | ||
+ | * Store with more sensors you can buy: https://www.elecfreaks.com/estore/ |
Latest revision as of 08:01, 7 September 2018
Contents
Visual Programming with Micro:bit, Tinkercademy, 7 Sept 2018
- Slides: http://tinyurl.com/ntuc2018
- Use Google Chrome for this: https://makecode.microbit.org/
- This is called Block programming. You need to "snap" the part in (if audio is on, it will make a snap sound).
- You can also use the javascript if you want to code directly.
- Start with Forever block and plug in different blocks, such as Show Number, Show LED.
- Then try using the buttons..
- Keep the forever block
- Good practice is to load something into on start so that you know if it is working and not a hardware issue.
Let's use the LEDs! Default values, or manually plotting X & Y Axis
X Axis
Y Axis
Inputs
Buttons
Step 1
Step 2
Shaking and Tilting
Step 3
Touching the pins
Step 4
Step 5
Create variables
Simple Counter
This only changes the variable, but doesn't show it. Something is missing here. ask the class to figure out how to "show" the number.
Randomiser
Conditionals
Make a scissors paper stone. Make micro:bit choose scissors, paper, or stone when shaken.
- Hints: create one variable called "number"
- Pick a random number from 0-2 so we have 3 numbers (0, 1, 2)
- And use the If else statements
This works
Improving the logic statement
Click on the Gear icon to edit the conditional statement
Scoreboard
- Next, let's record the scores.
- When you press A, it should add 1 to the score.
- When you press B, it should minus 1 to the score.
- You must have a variable called "score"
External Sensors
- You can connect it to P0, P1, P2 with crocodile clips
- When we read sensor info, we tend to want to do it forever
Compass
- Must be calibrated
Bluetooth
BoB Breakout Board
- LEDs on the Microbit should be facing you/up when you insert it in.
- You can connect up to 16 components.
- You can connect more power and toggle the 3.3V and 5V switch
Speaker
- Connect the piezo buzzer to P0
Types of I/O
- Add Potentiometer
- Add LED
- For this exercise, use pins 0, 1, 2. Note that for pins 4-10 the power is shared with the led and the LED on the board may show some effects.
Burglar Alarm
Add Packages
- Everytime you make a new project you'll need to re-add in the packages. You are only adding to that specific project each time.
- Use this version to generate items with the packages already loaded: http://tk.sg/pxt
Scissors Paper Stone
More resources for Microbits
- Click on PROJECTS to see more guided tutorials: https://makecode.microbit.org/
- Tinkercademy's curated store: https://gethacking.com/ / https://gethacking.com/collections/microbit
- IMDA's Microbit website with projects: https://www.imda.gov.sg/digitalmaker / https://www.imda.gov.sg/digitalmaker/make
- BBC's Microbit Project page: https://microbit.org/ideas/
- Store with more sensors you can buy: https://www.elecfreaks.com/estore/