Overview:
This project uses a cirucit playground, LEDs, and conductive thread to create a world map that can be illuminated to show in which part of the globe a story takes place. This will primarily be used as a piece of decoration in the classroom, and can have the entire section in which a story takes place illuminated for the duration of the story. This will be useful to help the students visualize the setting of a story, and to help them gain an appreication for literature from different parts of the world.
Grade Level:
9-12
Learning Objectives:
Students will be able to...
See computer science used in an English classroom
Visualize the regions in which a story takes place
Gain an appreciaiton for global storytelling
Supply List:
World map
Conductive thread
Sewing needle
One CPX
LEDs
Scissors
Power source
Coding:
Go to the website https://makecode.adafruit.com
From the Loops folder, drag six forever loops onto the workspace. These six forever loops will allow you to program six different light sequences
From the Logic folder, drag six if statements onto the workspace, and place each one inside of one of the forever loops
Then, from the Input folder, drag two button A is pressed inputs onto the workspace, and place each one over the true slot of two of the if statements
Click the dropdown menu on one of the button A is pressed inputs, and change it so that it reads button B is pressed
From the Pins folder, drag six digital write pin commands onto the workspace, slide them into the first if loop, and toggle the dropdown menues so they rear A1-A6. Then set pin A1 to high
From the Light folder, drag a show ring command onto the workspace, and insert it underneath the six pins. You can toggle the colors of each of the little circles to show whatever you want; I set all of mine to red.
So far, the code that has been written says that when you press button A, everything connected to pin A1 will be turned on, everything connected to the other pins will be turned off, and the light ring will be set to red.
Moving on to the next forever loop, the one with the button B input, copy and paste those same six pins from the first loop into this one.
Make sure to set pin A1 to low, and set pin A2 to high
Drag over another light ring, insert it into the loop, and toggle the lights to a different color than the previous ring.
This new block of code means that when button B is pressed, pin A2 will be turned on, every other pin will be turned off, and the light ring will turn orange (or whatever color you set it to).
From the Logic folder, drag over 4 "__ and __" functions. Insert each of these functions into the true hexagon on the if loops. This will allow you to create a block of code that uses two different inputs at once.
From the Input folder, drag over two button A is pressed inputs
Select one of your new loops, and plug the two inputs into each of the blank spaces on either side of the and.Â
Then toggle one of the button A is pressed inputs so that it reads button B is pressed
This new line of code means that if buttons A and B are pressed simultaneously, something will happen
Drag over six more digital write commands from the Pins folder, toggle all of them to low, and set pin A3 to high
Then, drag over one more light ring, set the lights to a new color, and insert it beneath the digital write pins
This new block of code means that when buttons A and B are pressed at the same time, all of the pins will be turned off, pin A3 will be turned on, and the light ring will turn a new color.
For this next forever loop, drag one button A is pressed input and one switch right input into the workspace
Insert each of these inputs into the blank spaces on either side of the and
Copy and paste or drag over six more of the digital write pins, set them all to low, and set pin A4 to high.
Insert these pins into the if loop
Drag over one more light ring, set the lights to a new color, and insert it beneath the six digital write pins
This new block of code means that when the switch is pushed to the right, and button A is pressed, the pins will turn off, the fourth pin will turn on, and the light ring will be set to a new color
The presence of the switch right input in this code block inversely means that the three previous blocks of code only work when the switch is pushed to the left
Replicate that same process for the fifth if loop, and toggle the button A is pressed input to turn it into a button B is pressed input
Insert six more digital write pins, set all of them to low, and set pin A5 to high
Grab one more light ring indicator, set the lights to a new color, and insert it into the if loop underneath the digital write pins
This new code block means that when the switch is pushed to the right and button B is pressed, all of the pins will turn off, pin A5 will turn on, and the light ring will show a new color
The last code block is the most difficult
Take your last if block, and insert a button A is pushed and a button B is pushed input into either side of the and block
Now, in the Logic folder, grab an extra if loop
Take the first if loop, the one that contains the button A and button B inputs, and place it inside the new if loop
Then place the new if loop inside the forever loop
Drag a switch right input into the true hexagon on the new if loop
Then, create the last six digital write pins and insert them into the primary if loop
Set all of the digital write pins to low, and set pin A6 to high
Grab one more light ring and insert it into the loop underneath the digital write pins, and set the lights on the indicator to a new color
This final block of code means that as long as the switch is pushed right, if you press buttons A and B simultaneously the A6 pin will light up, the other pins will turn off, and the light indicator will be set to a new color
Take your world map, and using a pencil, mark dots where you plan on placing the LEDs
Process:
Place your CPX somewhere on the world map (I placed mine over the compass rose), tie a knot in one end of the condictive thread, wrap the thread around one of the ground pins, and sew that thread through the back of the map. Repeat this process two more times, until there are three threads sewn into the ground pin of the CPX.
Next, take another conductive thread and sew it around pin A1 on the CPX, and punch the string through the back
Running the string along the back, thread the string from pin A1 to the positive end of your LED, sewing the LED onto the map
Take one of the strings from the ground pin and do the same thing, tying it to the negative end of that same LED, sewing that end of the LED into the map as well
Continue the process of sewing the LEDs into the map with the conductive thread for all of your LEDs, making sure the ground thread is connected to the negative end of the LEDs and the positive end of the LED is connected to a separate pin, A1-A6, for each LED
The final product will vary depending on how many LEDs you use and what your map looks like, but it will end up looking something like this: