Getting Started With JavaScript Blocks: Love Meter Worksheet
Challenge 8
You are going to design, test and build a program that reads the input pins on the micro:bit.
Step 1
Head to the micro:bit website and go to the Let’s Code tab. JavaScript Block Editor.
Open the JavaScript Block Editor, you should see something like this.
Remove all the blocks by either dragging each block back to the library or selecting the block and pressing the delete key.
Self-Assessment
¨ I can load up the software on the micro:bit website.
¨ I can clear the workspace ready for building a new program.
Step 2
The Pins on the micro:bit can detect inputs from different devices and can be programmed to be an output. In this project you will use your hands as an input. The human body conducts electricity. Find out the answers to the following questions.
How does electricity work?Why does the human body conduct electricity?
What is resistance & what is your body’s resistance?
Step 3
JavasSript editor allows the use of blocks and JavaScript. For each of the blocks below write the JavaScript code.
JavaScript Block / JavaScript CodeStep 4
Three inputs are needed based upon the three pins, Pin0, Pin1 and Pin2. Inside each loop a different display is needed. A heart image, the string “Love” and a random number from 0 to 9.
Step 5
Screen print of working programStep 6
Copy and paste the JavaScript belowSelf-Assessment
¨ I can convert basic blocks into JavaScript
¨ I can receive an input based upon the micro:bit pins
Challenges
Well done for completing the Love Meter project. Try to connect some real world components to build your own circuits using the input pins. An number of examples on the micro:bit website.
3
Ó micro:bit Educational Foundation 2016