Код:
sprite = game.create_sprite(0, 0)

def on_forever():
    global sprite
    pitch = input.rotation(Rotation.PITCH)
    roll = input.rotation(Rotation.ROLL)
    sprite.set(LedSpriteProperty.X, Math.map(roll, -45, 45, 0, 4))
    sprite.set(LedSpriteProperty.Y, Math.map(pitch, -45, 45, 0, 4))

basic.forever(on_forever)