Micro:Bit
Light Sensor & Sound
Both Input (light level) & Output (show)
Display Light Level
You will create a program to display the light level on your micro:bit
Your program should forever:
Download your programed named as LightSound and flash to your micro:bit. Make sure to test in various light levels & pay attention to the numbers displayed. Use a flashlight to make light brighter or use something to cover your micro:bit to make it darker.���
Code you will need:
Plot Light Level
You will rewrite your LightSound program to display a bar graph of the light level on your micro:bit.
Your program should forever plot the current Light Level with a maximum value of 255.
Again download your program named as LightSound and flash to your micro:bit. You will be replacing the program you made on slide 3. Test with varying light levels & watch the display.���
Code you will need:
255
Add Sound
Your program should forever plot the current Light Level with a maximum value of 255 AND play one or more notes or a song based on a condition. Think back to the light levels you saw in your first program and use those to create a condition that will sometimes happen. Add your new code into your forever loop - do NOT delete your previous code.
Want more notes than you see or need Hz value for JavaScript, check out Player Piano.
Download your program named as LightSound. You will be replacing the program you made on slide 4.
Follow the Hack Your Headphones instructions to play sound through your headphones from the micro:bit.
Copy your program to micro:bit, and test! ��
Code you will need:
Optional Extension:
Add code to button A or B (or both) to start a melody when the button is pressed. Do NOT repeat this forever. You need to be able to hear the response to light levels.
You decide which condition OR conditions (use else if/else for multiple conditions)
You decide which music play boxes (play tone OR play ringtone) to use & which tone(s)
Radio Challenge
Find a partner and work together to complete the challenge. You must both use the same radio group number - use the number of one of your computers to make sure it is unique.
You will need the Radio Reference Documents.
Download your program named as LightSoundRadio1 OR LightSoundRadio2. Copy your program to the micro:bit, and test! Make sure to test in various light levels.���