STEP 14: Time doesn't move beyond zero! That's not right!

+= is a useful tool in Python which allows us to add to existing integer variables.

  • In LOGIC, go to and drag Add Value into the interval event.
  • Change the variable to the left of the equals sign from my_var to time.
  • Click Run to see our scatter plot graph points farther along the x axis.

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) stage.event_interval(interval, 2)
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)