CS170: Programming for the World Around Us - Social Vicinity Tracking with the micro:bit

Activity Goals

The goals of this activity are:
  1. To use arrays to store collections of data

The Activity


Consider the activity models and answer the questions provided. First reflect on these questions on your own briefly, before discussing and comparing your thoughts with your group. Appoint one member of your group to discuss your findings with the class, and the rest of the group should help that member prepare their response. Answer each question individually from the activity, and compare with your group to prepare for our whole-class discussion. After class, think about the questions in the reflective prompt and respond to those individually in your notebook. Report out on areas of disagreement or items for which you and your group identified alternative approaches. Write down and report out questions you encountered along the way for group discussion.

Model 1: Social Vicinity Tracker using the micro:bit

If you take me out of it, I find "six degrees" to be a beautiful concept that we should try to live by.
Kevin Bacon


  1. Turn to the people around you and say hello to them, and tell them where you’re from.
  2. As best you can, count how many words you hear each person in the room say. You might need some paper for this!
  3. How did you keep track?

Model 2: Tracking Collections of Data



  1. You can create "arrays" of data to do this automatically! In python, this creates a table for each of 5 of your friends, each set to 0 words: friends = [0,0,0,0,0]
  2. Where do you see tables like this in your own life?
  3. What should you do each time you receive a radio message from a friend?
  4. How can you keep track of which person you're communicating with?
  5. The radio received event can send a number! Send a different number for each person. How should we store this special "radio number?"
  6. Modify the program so that each person can pick their unique radio number by incrementing the variable by 1 every time the A button is pressed. Perhaps display it on the screen so you know which radio number you will use (and make sure no-one else is using it).
  7. When you press the other button, show one of the values from the array on screen. You can use another variable for this.
  8. Why send hello = radio_number rather than just the radio number like we did before? Either way works, but what additional flexibility do you gain by using this block?
  9. How can you modify this program so that instead of showing the number of messages you've received, you show instead the number of seconds you were near one another? What would you need to do to figure out a conversion between messages seen and time? As a hint: can you guess how long someone was speaking by counting the number of words you heard them say? How might you do this?


I encourage you to submit your answers to the questions (and ask your own questions!) using the Class Activity Questions discussion board. You may also respond to questions or comments made by others, or ask follow-up questions there. Answer any reflective prompt questions in the Reflective Journal section of your OneNote Classroom personal section. You can find the link to the class notebook on the syllabus.

Teacher Highlights

  • Teachers can set up a MakeCode Classroom environment by activating this template.