1-1 Binary Secret Code - Introduction to Abstraction
We are moving on to Standard 6 which is about levels of abstraction. To understand what is meant by that, we're starting with a secret message in binary code
Binary code as a text file
In this video, Mr. Weinberg introduces the idea of abstraction and teaches you to use Python to decrypt this binary code.
YouTube Video 20:39
Link to starter code in Replit
2-1 Abstraction vs. Problem Decomposition
Discussion forum on Schoology
2-2 Three Boards, Three Flavors
Watch this short video intro to our case study for today. It shows three different microcontroller boards running three different programs that achieve the same overall goal.
YouTube Video 1:42
2-3 Case Study Three Boards - Google Doc
Make a copy of this Google Document to fill out with your group members as you look into the video and explore the code.
Some microcomputers we used to build and program a state machine. Here for "Three Boards, Three Flavors".
3-1 Introduction to State Machine Programming
Based on what you did last time analyzing the code of a microcontroller board and accelerometer, this video introduces how the concept of a state machine makes this code more modular and easier to debug. The idea is to refactor the code that deals with inputs, outputs, and the logic into separate functions. This abstraction makes it easier to build more complex programs than you might otherwise be able to program.
YouTube Video (7:35)
3-2 Case Study: Escape to Summer
The code at the above link was for an escape room activity that I designed for an end of year activity in 2019. There is a lot of code there, and you are not required to understand it all. That said, it is a case study for the concept of a state machine that I introduced in the last video.
Play around with the code to see what it does. As you play, identify the following in your personal Google Doc for W6-5:
Link to MakeCode code 385 lines
3-3 Escape to Summer Case Study - Submit Your Responses
Hint: Look at line 60
const CORRECT_SEQUENCE = "ABABABBABA"
4-1 Combination Lock Case Study
We will use this as a warm-up during class. The video shows a state machine in operation to control a combination lock.
Video Link (0:16)
What are the states of the system shown in the video?
What causes transitions between states? (Look very carefully!)
What is happening in the updateSystem function?
4-2 Drink Dispenser Video
In this video, I build a complete state machine system from scratch to control a water dispenser that keeps the water within it at a certain temperature range.
YouTube Video (19:48)
You can use this starter code to follow along with the video.
4-3 Completed Drink Dispenser
Students submit a link to their completed Drink Dispenser code. They must use the share button in MakeCode for this to work. Google Doc for submission
Today we’re going to create the physical part for the drink dispenser. And it is not just uploading the code and connecting the correct wires (a challenging part each year) but we want to have a look at some electrical properties like:
Voltage V
Current I
Resistance R = U/I
Power P = U ⨉ I
Submit a picture or video of your working drink dispenser to this link. W7-3 Drink Dispenser VIDEO
6-1 Warmup - Fix it!
Oh no! Nora got onto her dad's computer to do a virtual school assignment. It seems she has messed up some of his state machine code for class. Luckily he has the broken code and some images to help.
In your pairs, you will work on piecing together the broken code. When you are ready to test it out, let Mr. Kreier know.
You only need to fix the state machine code - leave the rest as it is!
Submissions in replit, then tested on a Circuit Playground Express
6-2 Iterative design for Quarter 1
YouTube Link (6:21) What is Iterative Design?
Post a document that meets the C+ descriptors for Standard 2 on your website. Showing at least three versions of a single design and with a brief explanation of the project/assignment/task you were doing these iterations for. This will be used for peer feedback and for feedback from me.
William - Micro:bit timer
Dongjae - Phone Selector App
Dan - VEX VR trash collector 2021
Khang - temperature dependent leds
7-1 Choosing your System
Your house is filled with devices that can be modeled and controlled using a state machine. You might even consider systems that aren't in your house, but that you have seen out and about. Your task for this week is to take one of these systems and write software to model its operation using a state machine.
Mr. Weinberg is going through this process with a microwave. The key thing to keep in mind is that:
You want clear inputs (sensors, buttons, time) that allows a user to interact with the device
The system should ideally have different states with clearly different behaviors in each one.
In the micro:bit simulator, the outputs include lights, sound, print statements, Neopixels, and servos. You want to use these to simulate the possible outputs your system might have.
A refrigerator is always keeping things cold. One job, one mode, one state. That isn't very interesting for the purpose of this project. A phone runs many different apps and does many different things - that is too complex.
Things to consider:
electric fan with a knob to select speed
a flashlight with different blinking modes
a nap timer that uses lights and sounds to wake you
a morning alarm that wakes you at one time if the pollution level is low, and a different time if pollution is high
an air conditioning system
a height adjustable table
a rice cooker
an ice maker
a desk lamp with dimming section
a water purification system
an alarm clock with REM sleep tracking feature
7-2 Defining your State System
Watch this video to see how Mr. Weinberg thinks through how a state system might model the operation of a microwave.
YouTube link (11:53)
7-3 Proposal for State Machine
You (and a partner if you wish) will work to define a state machine for this task.
8-1 Microwave State Program W8-4
Mr. Weinberg built and commented on a version of this program in Python. You should be able to read the comments comparing the content of his example with the program here.
8-1 Build 1 Dashboard W8-5
Visit this link to post the info for your work on this project.
8-3 Makecode Python State Machine Template W8-6
A student suggested it would be helpful to have some starter code in Python like what I gave you for the Water Dispenser.
9-1 Standard 5 - Inputs, Outputs, Hardware W9-1
Standard 5 Rubric for the State Machine, linked in the State Machine Dashboard
9-2 New State Machine Example - Star Night light W9-2
The edited version (which has all of the idle time removed) is on YouTube:
Makecode Micro:bit - Star Night Light (Final Code)
10-1 Standard 6 - Levels of Abstraction/ Layers Rubric
Standard 6 Rubric copied into documentation for assessment (mastery check)
10-2 Levels and Layers in State Machines
To help students understand the relationship between different layers in a state machine, I gave this example for them to talk through in groups
Link to File - 3 slides with layers of abstraction software/hardware/operating system
10-4 The iPad Helicopter
An automation designer thinks at different levels of abstraction in order to make it possible for a complex machine to be easily controlled.
This task gets students to think through how an automated helicopter is an example of abstraction and states.
11-1 The Crane Game
This activity gets students thinking about a crane game and abstraction.
A layer is really any grouping of hardware or software that all serve a similar function. Some examples:
The user input software layer was what we discussed in the crane game as the functions that corresponded with direct actions of the user. clawButtonPressed, joystickPushedForward
The user input hardware layer includes the two axes of the joystick and claw buttons
An output software layer involves a set of functions that all control hardware outputs.
An output hardware layer would be the set of motors that control the movement of parts of the crane game and the physical lights that blink as outputs.
11-2 Standard 6 Assignment
Using any of the projects you have done this semester (Module Maker, Drink Machine, State Machine) or code samples that Mr. Weinberg has given you (Escape to Summer, Shock Detector, Three Flavors) create a document that shows your analysis of the code according to the standard 6 rubric.
Some of you have already completed this in your state machine document. To help in keeping feedback on the different standards separate, please submit a link to your state machine document again to this assignment.