STEP 15: We need to update our graph every second, not every two!

The second parameter of an interval event specifies how many seconds should pass before it runs again.

  • In the very last line of code, find where it says stage.event_interval(interval,·2) .
  • Change the second parameter from 2 to 1. This will make sure our interval event runs every second!
  • 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 time_list.append(time) my_display.update(time_list, data_list) time += 1 stage.event_interval(interval, 2)
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)