In this lesson, students will code the buttons on the Micro:bit to show that it’s happy or sad. This lesson is based on Python. Here, students are going to learn the concepts of functions.
A function is a block of code which only runs when it is called. You can pass data, known as parameters, into a function. A function can return data as a result.
In Python a function is defined using the def keyword.
Performance Expectations
By the end of the lesson, you will be able to learn:
To use buttons as an Input source in the activity
About different programming blocks
The concepts of functions in python
Guiding Ideas
In this activity, students should use the button ‘A’ and ‘B’ as input to generate the emojis and show it on the LED display as an output. Here students have to use the functions and arguments of python to generate the result.
Disclaimer: All content under this course is customized according to the requirement of an educator/student (K12) filtered from Minecraft Education Edition, MakeCode Microbit, Code.org, and other sources.