STEP 12: Now that we can access time using the global keyword, let's store the current time in a list.

  • In LOGIC, go to and drag Append into the interval event.
  • Change the list name in front of the append command from my_list to time_list.
  • Change the parameter of the append command from my_var to time.
  • Click Run. Then click Submit and Next to move on.

To navigate the page using the TAB key, first press ESC to exit the code editor.

microbit = codesters.Microbit() microbit.show_string("hello") data = microbit.get_temp() microbit.show_number(data) data_list = [] time_list = [] my_display = codesters.ScatterPlot(time_list, data_list) time = 0 def interval(): data = microbit.get_temp() data_list.append(data) global time stage.event_interval(interval, 2)
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)