Author Archives: Mr. M

Microbit Day 2: Variables

Make a new project at https://makecode.microbit.org/

Activity 1: Temperature Limit Check

Objective: To create a program that continuously runs and measures the temperature. If the termperature is above a certain limit, then the program displays a heart icon.

Instructions Create a variable (link) called warmLimit ; give a value of 25. If the temperature is above 25, show a heart. To do this use an if/else (link). The links are hints , they do not show you exactly what to do. (How to link) There is one flaw with my code. See if you can fix it. It’s from a prior lesson, not the new stuff.

Modification: Once you have completed this do a Fahrenheit version (link). You will need to change the temperature limit though from 25 to something more like 75 or 80 since you’re now in Fahrenheit

Activity 2 : Shake Counter

Objective : To create a program that counts how many times the micro:bit is shaken. Each time the micro:bit is shaken, the program adds one to a running total and displays the new count on the screen.

Instructions at the start of the program make a variable called shakes; then use an on shake event (link) to increase the variable by 1 (link) and then display the variable.

Once you have that done, add an if test so that when the shakes variable is greater than or equal to 10, display an image.

Activity 3 (if time)

Objective : To create a program that acts like a dice. Each time the micro:bit is shaken, the program picks a random number from 1 to 6 and displays it on the screen.

Instructions 1) on start, make a variable called roll 2) on shake set the value of that variable to a random number (link) between 1 and 6 and display the number.

If you have time, we are going to modify this tomorrow, start thinking of how you could do this : instead of showing the number 1 or 2 or 4.. use the show leds command to draw a die side that ilooks like a 1 or a 2 . For instance, here’s how you could show a “1”: (link)

Microbit Makecode Temperature Measurement

Activity (Lower Computational Thinking)

Step 1 : build forever → show number → temperature. ( how to link)

Flash to device (link).

Step 2 : Scavenge Hunt Battery pack on, roam the room. Record on a paper table. Write each number

  • by the window,
  • near a laptop,
  • in a cupped hand,
  • on the floor. 4–5 spots write the number each time..

Extension: The micro:bit thinks of temp in Celsius. Convert that reading into Fahrenheit for display and your logs; the micro:To do this, you must be able to make a variable and then implement the conversion formula. Here’s one way: (how to )

Activity (Upper Computational Thinking)

Step 1 : Two Numbers 1 Device : button A → temperature, B → light level (how to link)

Two sensors, one device.

Flash once .

Step 2 : Scavenge Hunt Battery pack on, roam the room. Record on a paper table. Log both temperature and light at each spot, and record a second reading at each spot 30 seconds apart to see if it drifts. 4–5 spots

  • by the window,
  • near a laptop,
  • in a cupped hand,
  • on the floor. 4–5 spots write the number each time..

Extension: The micro:bit thinks of temp in Celsius. Convert that reading into Fahrenheit for display and your logs; the micro:To do this, you must be able to make a variable and then implement the conversion formula. Here’s one way: (how to )

Make Code Radio Communication

Every microbit has a 2.4 GHZ radio module bulit into the CPU.

Below is demo of what we are going to do in this short tutorial–send a number of radio waves from one microbit to the other:


Microbit 1: The Sender

Radio Group. Both microbits must be set to the same group number. I chose the number 5. Just make sure you set that first (on start).


Microbit 2: The Receiver

Most common error is not setting the same radio group on both microbits.

Microbit How To’s

How to make a variable and assign it a value

If/else if / else with a variable

Create a variable and set it to a random number:

Plot Bar Graph

Radio Communication . Read the Tutorial Here

Coming soon…Next how to

Mars : Missions

Start Coding here : https://makecode.microbit.org/

How to do common stuff with MakeCode

The Missions  

Topics/Links : On Start Show String

Stuck? Check out this code


Topics/links : Button A

Stuck? Check out this code


Topics/links : Button A , if / else , set variable

Stuck? Some of the code


Topics/links : Shake Event, if else , set variable to random ,

NOTE: Please make sure you save a copy of Mission 4. Don’t lose it! (We might use it later)

Result :


Code for Forever loop/ plot bar graph/acceleration


This is a 2-parter. Part I involves upgrading the Mission 4 scout

Topics/links for Part I : Shake Event , Radio Communication Full Example

Topics/links : Shake Event , set radio group, on radio receive , on radio receive number if/else Radio Communication Full example

Winter Break Themed

Use onshape to generate a winter themed 3-d drawing. The more complex, the more points.

Ideas include : snowflake, snowman, Hanukkah candles, christmas tree with presents

Example of 5 out of 5 initial outline

winter-themed-onshape_5

Example of 3 out of 5

winter-themed-onshape_3

 

 

Some good actual examples of completed projects

snowflake extruded

Fillet and Shell

Units : MM

Step 1) Inscribed Triangle . Dimensioned to 22. Centered at origin

inscribed triangle

Step 2)  Make 1 vertex of triangle vertical with the origin. This will define the shape

inscribed triangle 2

Step 3)  This is what your shape should now look like :

inscribed triangle 3

Step 4) Use the scissor tool to delete the top 3rd of the circle

inscribed triangle 4

Step 5) Connect the 2 points (make sure it’s defined)

inscribed triangle 5

 

Step 6) Perform 2 extrudes (25 and 35). :

inscribed triangle 6

Step 7)  Fillet as shown:

inscribed triangle 7

Step 8)   Add a shell:

inscribed triangle 8

 

Step 9)  Final product:

inscribed triangle 9