This assignment asks you to use the GPIO pins of the micro:bit to achieve external I/O, that is, I/O with devices/circuits that are not on the micro:bit itself. This is a lab assignment. You will be provided with a micro:bit breakout board to get you focused on programming and circuit building.
- Start with this SparkFun breakout board hookup guide. Build the circuit, using 3 LEDs of different colors. Remember the proper orientation of the LEDs (long leg toward higher voltage). Commit the JavaScript file to your assignment repository. Call it
original.js
. Notice that you have to disable the on-board LEDs to work with the external pins (see the documentation for the GPIO edge connector. - Modify the program to do something interesting with the 3 LEDs. Commit the modified JavaScript file to your assignment repository. Call it
new-program.js
. - (Bonus) Add more analog output LEDs and write a new program to drive them in an interesting way. Commit the modified JavaScript file to your assignment repository. Call it
more-leds.js
.
- Keeping at least one analog output pin, open a digital input pin and hook it up to a TTL input button on the workstation. Light the external LED when you detect a 1 on the input button (that is, the button is pressed). Commit the modified JavaScript file to your assignment repository. Call it
digital-in.js
. Do you need a pullup resistor? - (Bonus) Try to drive one of the internal LEDs and the external LED on the analog output pin at the same time. Commit the modified JavaScript file to your assignment repository. Call it
on-board-and-external-out.js
.
-
For each programming file, record a short video of the LED operation. Upload to Imgur.
-
(Bonus) Make one video out of the different clips and upload to Imgur.
- The file should have a name and the
.js
file extension. - A project description should be included in this README file, and a leading comment in the JS file.
- The program should have proper indentation.
- Every block of code should contain inline comments, briefly describing its purpose and functionality.
- The program should have good structure, with asynchronous and synchronous code blocks properly differentiated. Note: You cannot have more than one
forever
loop. - Variables should be named in either of the following styles:
variable_name_of_underscore_delimited_lower_case_words
, orvariableNameInCamelCase
- Variables should be declared with full static data types.
- Programmatic functionality should be encapsulated in functions, and, optionally for bonus points, classes.
- Functions in JavaScript are 1st class objects. All event constructs like
onButtonPressed
andonGesture
take functions as arguments. - A maximum variety of JS language constructs (loops, conditionals, various operators, encapsulations, event handling, etc) should be used.
- Use of buttons and/or guestures.
- Sensible display update.
- Non-trivial functionality.
- Control complexity.
- micro:bit lessons.
- micro:bit ideas.
- A list of some more advanced projects.
- The assembled micro:bit resources at the awesome micro:bit list.
- micro:bit reference, and specifically the pins section.
- The technical documentation for the micro:bit GPIO edge connector.
- Github Tutorial for Beginners (webpage).
- Github Basics for Mac and Windows (video).
- git & Github Crash Course for Beginners (video).
- Introduction to Github for Beginners (video).
- About
git
(webpage). git
documentation (webpage, book, videos, reference manual).- Github markdown cheat sheet.
- Technically, the language which is used side-by-side with Blocks in the Makecode environment is a subset of TypeScript, which itself is a superset of JavaScript (technically, ECMAScript), with some JS features not implemented in Makecode.
- The limited JavaScript mini-tutorial in Makecode. Make sure you read it but that can't be your only reference.
- Official TypeScript documentation:
- TypeScript in 5 min tutorial. Highly recommended! You will need to download and install an integrated development envinronment (IDE). The two that I recommend are Visual Studio Code from Microsoft and WebStorm from JetBrains.
- The full documentation and reference is under Handbook. Bear in mind that you are drinking from the hose. Don't be surprised if not everything is presented in a strictly incremental manner.
- The Microsoft TypeScript page on Github, including the TypeScript language sepecification.
- In-browser TypeScript playground. Note that micro:bit specific code will not run, but you can still play. Start making the distinction between a generic multi-purpose programming language (TypeScript) and functionality (packages, libraries, objects, etc.) that is specific to a particular device (micro:bit), though written in the same programming language.
- A pretty good and very palatable JS tutorial with in-browser coding, by Codecademy.
- Extensive and detailed JS tutorial, with some advanced material thrown in. I like this one!
- The most authoritative JS resource on the Web, including tutorials and reference, by Mozilla.
TODO: Your project description, in your own words. Clarity and grammatical correctness are required.