Accelerometer
The StudioBot includes an accelerometer that can be used to detect movement.
import time
import board
from StudioBot import *
while True:
x, y, z = imu.acceleration
print(x, y, z)
time.sleep(0.1)import time
import board
from StudioBot import *
while True:
if imu.shake(shake_threshold=15):
print("Shaken!")
time.sleep(0.1)Last updated