STEP 9: Now that our interval event is set up, let's get ready to collect data in the lists!

Remember, code that should happen during an event needs to be indented four spaces.

  • Find this line inside your interval event: temp·=·microbit.get_temp()
  • Change the variable to the left of the = sign from temp to data. We want the variable name to be general.
  • 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(): temp = microbit.get_temp() stage.event_interval(interval, 2)
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)