import hub

print("=====HUB=====")
print("=Hub=")
print(hub.__version__)
print(hub.config)
print(hub.info())
print(hub.status())
# hub.power_off()
# hub.repl_restart()
print(hub.temperature())
hub.led(3)
# hub.file_transfer()
print(hub.TOP)
print(hub.FRONT)
print(hub.RIGHT)
print(hub.BOTTOM)
print(hub.BACK)
print(hub.LEFT)

print("=Battery=")
print(hub.battery.voltage())
print(hub.battery.current())
print(hub.battery.capacity_left())
print(hub.battery.temperature())
print(hub.battery.charger_detect())
print(hub.battery.info())

print("=Bluetooth=")
print(hub.bluetooth.discoverable())
print(hub.bluetooth.info())
# hub.bluetooth.forget(address)
print(hub.bluetooth.lwp_advertise())
# hub.bluetooth.lwp_bypass()
# hub.bluetooth.lwp_monitor()

print("=Button=")
print(hub.button.left)
print(dir(hub.button))
print(hub.button.left.is_pressed())
print(hub.button.left.was_pressed())
print(hub.button.left.presses())
# print(hub.button.left.callback())

print("=Display=")
hub.display.clear()
hub.display.rotation(0)
print(hub.display.align(hub.RIGHT))
hub.display.invert()
# hub.display.callback()
hub.display.pixel(1,1,9)
# hub.display.show()

print("=Motion=")
print(hub.motion.accelerometer())
print(hub.motion.gyroscope())
# hub.motion.align_to_model()
print(hub.motion.yaw_pitch_roll())
print(hub.motion.orientation())
print(hub.motion.gesture())

print("=Port=")
print(hub.port.A)

print("=Sound=")
print(hub.sound.volume())
hub.sound.beep()
# hub.sound.play()
# hub.sound.callback()

print("=Supervision=")
print(hub.supervision.info())
# hub.supervision.callback()

print("=Image=")
hub.display.show(hub.Image.ARROW_W)
print(hub.Image.ARROW_W.width())

print("=BT_VCP=")
print(hub.BT_VCP().isconnected())

print("=USB_VCP=")
print(hub.USB_VCP(0).isconnected())

print("=Port=")
print(hub.port.A.info()['modes'][3])

print("=Device=")
print(hub.port.A.device.get(0))
print("=Motor=")
print(hub.port.A.motor.get(0))
print("=MotorPair=")
print(hub.port.A.motor.pair(hub.port.B.motor))
print("=Pin=")
hub.port.E.mode(3)
print(dir(hub.port.E))
print(hub.port.E.p5.direction(0))

print("=====END=====")

raise SystemExit

References

  1. Hub Programming API
  2. hub-module-notes/Unofficial LEGO MINDSTORMS and SPIKE Prime low-level hub module documentation
  3. Advanced undocumented Python in LEGO SPIKE Prime and MINDSTORMS hubs
  4. Hub Documentation