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)
t = codesters.Teacher()
try:
param = t.find_text("stage.event_interval")
tval2 = param[0][1].replace(" ", "")
except:
tval2 = "DNE"
t1 = TestObjective()
t1.add_success(',1)' in tval2, "Great job!")
t1.add_failure(tval2 == "DNE", "Did you add an interval event?")
t1.add_failure(',2)' in tval2, "Did you change the interval of your Interval Event?")
t1.add_failure(',1)' not in tval2, "Make sure you change the interval of your Interval event to 1!")
tester = TestManager()
tester.add_test_list([t1])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Submit Work
-
Next Activity
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)