from microbit import * import log import time # Logging will be mirrored on console. log.set_mirroring(True) # Define which columns we are going to log, and disable timestamps log.set_labels('launch_ts', 'ax', 'ay', 'az', timestamp=None) # The standard setting only allows accelerations up to 2g, we want 8g! accelerometer.set_range(8) START_TS = time.ticks_ms() # start timestamp # Set the timer to log data every 20 milliseconds (50 measurements per second) @run_every(ms=20) def log_single_row(): # Timestamp in milliseconds since countdown start. timestamp = time.ticks_ms() - START_TS accel = accelerometer.get_values() log.add(launch_ts=timestamp, ax=accel[0], ay=accel[1], az=accel[2]) while True: sleep(100) # sleep forever