BOUNCING BALL 2

Project: Bouncing Ball using accelerometer – x direction only

TILT_FORCE = 0.1

STEP = 0.1

x, y = (3, 3)

while True:

   x_force, y_force, z_force = accel.forces()

   

   if x_force > TILT_FORCE:

       x -= STEP

   elif x_force < -TILT_FORCE:

       x += STEP



   fb.erase()

   fb.point(round(x), round(y))

   fb.show()

   

   time.sleep(.1)

home | prev | next