# This isn't the acceleration but the SLOPE (change!) in acceleration
x, y, z = sensor.acceleration
# take the vector length by squaring, adding, taking root
slope_g = math.sqrt(x*x + y*y + z*z) / 9.8 # take vector, convert to g
# we'll track the max delta g
if max_slope < slope_g:
max_slope = slope_g
print(slope_g)
text_area.text = "Max Slope %0.1fg" % (max_slope)
if max_slope >= 9 and egg_ok:
gegg_sprite.x = 300
time.sleep(0.1)
egg_ok = False
buzzer.duty_cycle = 2**15
time.sleep(2)
buzzer.duty_cycle = 0
continue