Lpf2-micropython

Getting started

  • Quickstart
    • Minimal program
    • Event-driven form
    • What the modules do
  • Examples
    • Distance sensor
    • Dumb-car (two motors + remote)
    • Port expander
    • IMU
    • LCD (LVGL)
    • BLE remote hub
    • Grove I2C (MPU-6050)
    • NeoPixel on a repurposed LPF2 port
      • Why hub.ports.D.disable() first
      • Re-enabling the port

Hub module

  • The hub module
    • Top-level members
    • Reference
  • Ports
    • Members
    • Lifecycle
    • Pausing a port
    • Reading sensor values
    • Wrapped built-in ports
  • Hub LED
  • IMU
    • Attitude
    • Raw samples
    • Calibration
    • Example loop
  • Buttons
    • Level readers
    • Callbacks
    • Manual polling (bare scripts)
    • Exiting a program
    • Power-off
    • Callback registry snapshots
  • LCD
    • Init
    • Rendering loop
    • Backlight
    • Raw panel access
    • Soft reset
  • I2C (Grove connector)
    • Coexistence with the C++ side
    • Pins
    • Quickstart
    • Raw write / read
    • Register access
    • Full example — MPU-6050 accelerometer on Grove
    • API reference
  • Board constants
    • SD card
    • Port pins
  • Program lifecycle
    • The @hub.on decorator
    • Powering off
    • Log level
  • Host protocol framing
    • Why the C-level hook
    • Transport fan-out
    • Typical usage
    • Notes

LPF2 module

  • The lpf2 module
    • Layout
    • Design notes
      • Automatic polling
      • Subclassing
  • Ports
    • Lifecycle & polling
    • Detecting a device
    • Mode selection
    • Direct motor commands
    • Introspection
    • Raw I/O
  • Devices
    • Common methods
    • Registering factories
  • Motors
    • Conventions
    • Open-loop power
    • Continuous speed
    • Timed moves
    • Relative-degree moves
    • Absolute position
    • Ramp profiles
    • Motor tuning presets
  • Sensors
    • Colour sensor
    • Distance sensor
    • Colour + distance (legacy)
    • Built-in inertial sensors
  • Virtual devices
    • The pieces
    • Building a descriptor
    • Subclassing device
    • Attaching and running
    • GC pitfalls
  • Hub emulation
    • Typical setup
    • Runtime updates
    • Stop
    • Lifetime
  • Remote hub (BLE client)
    • Basic pattern
    • Ports on the remote hub
    • Manual port configuration
    • Hub properties
    • State flags
    • Shutdown
  • Battery
    • Voltage window
    • Manual voltage updates
    • Custom percent mapping
    • Built-in ADC reader
  • Enumerations
    • lpf2.color
    • lpf2.device_type
    • lpf2.hub_type
    • lpf2.alerts
    • lpf2.battery_type
    • lpf2.button_state
    • lpf2.hub_property
    • lpf2.port_num
  • Port expander
    • Sub-port numbering
    • Client side
    • Server side

Reference

  • hub
    • Attributes
    • Functions
    • Module Contents
      • exit()
      • flush_output()
      • on()
      • powerOff()
      • raw_write()
      • set_frame_sink()
      • set_framed_output()
      • sleep()
      • sleep_ms()
      • accelerometer
      • board
      • buttons
      • gyro
      • i2c
      • imu
      • lcd
      • led
      • log
      • ports
  • lpf2
    • Submodules
      • lpf2.alerts
        • Attributes
        • Module Contents
      • lpf2.battery_type
        • Attributes
        • Module Contents
      • lpf2.button_state
        • Attributes
        • Module Contents
      • lpf2.color
        • Attributes
        • Module Contents
      • lpf2.device_type
        • Attributes
        • Module Contents
      • lpf2.devices
        • Classes
        • Functions
        • Package Contents
      • lpf2.hub_property
        • Attributes
        • Module Contents
      • lpf2.hub_type
        • Attributes
        • Module Contents
      • lpf2.local
        • Classes
        • Package Contents
      • lpf2.port_expander
        • Submodules
        • Classes
        • Package Contents
      • lpf2.port_num
        • Submodules
      • lpf2.virtual
        • Classes
        • Package Contents
    • Classes
    • Package Contents
      • battery
        • battery.getCurrentVoltage()
        • battery.getMaxVoltage()
        • battery.getMinVoltage()
        • battery.getPercent()
        • battery.readBatteryVoltage()
        • battery.setCurrentVoltage()
        • battery.setMaxVoltage()
        • battery.setMinVoltage()
        • battery.setPercentFunc()
        • battery.setupAdcDivider()
      • device_descriptor
        • device_descriptor.fwVersion
        • device_descriptor.hwVersion
        • device_descriptor.modes
      • hub
        • hub.connectHub()
        • hub.getAllInfoStr()
        • hub.getBatteryType()
        • hub.getHubAddress()
        • hub.getHubPropStr()
        • hub.getHubType()
        • hub.getName()
        • hub.getPort()
        • hub.infoReady()
        • hub.init()
        • hub.isConnected()
        • hub.isConnecting()
        • hub.isScanning()
        • hub.setName()
        • hub.setPortMode()
        • hub.setPortModeCombo()
        • hub.shutDownHub()
        • hub.update()
      • hub_emulation
        • hub_emulation.attachPort()
        • hub_emulation.getName()
        • hub_emulation.setAlert()
        • hub_emulation.setBatteryLevel()
        • hub_emulation.setBatteryType()
        • hub_emulation.setButtonState()
        • hub_emulation.setFirmwareVersion()
        • hub_emulation.setHardwareVersion()
        • hub_emulation.setName()
        • hub_emulation.setUseBuiltInDevices()
        • hub_emulation.start()
        • hub_emulation.stop()
      • mode
        • mode.PCTmax
        • mode.PCTmin
        • mode.SImax
        • mode.SImin
        • mode.dataSets
        • mode.decimals
        • mode.figures
        • mode.flags
        • mode.format
        • mode.inMapping
        • mode.max
        • mode.min
        • mode.motorBias
        • mode.name
        • mode.outMapping
        • mode.rawData
      • motor_setting
        • motor_setting.medium_linear
        • motor_setting.technic_large_angular
        • motor_setting.technic_large_angular_grey
        • motor_setting.technic_large_linear
        • motor_setting.technic_medium_angular
        • motor_setting.technic_medium_angular_grey
        • motor_setting.technic_xlarge_linear
      • port
        • port.device()
        • port.disable()
        • port.getCapabilities()
        • port.getDeviceType()
        • port.getInfoStr()
        • port.getInputModes()
        • port.getMode()
        • port.getModeCombo()
        • port.getModeComboCount()
        • port.getModeCount()
        • port.getOutputModes()
        • port.getValue()
        • port.getValueStr()
        • port.getViewCount()
        • port.gotoAbsPosition()
        • port.init()
        • port.isDeviceConnected()
        • port.isDisabled()
        • port.presetEncoder()
        • port.rawToSpeed()
        • port.setAccTime()
        • port.setDecTime()
        • port.setMode()
        • port.setModeCombo()
        • port.setRgbColor()
        • port.setRgbColorIdx()
        • port.speedToRaw()
        • port.startPower()
        • port.startSpeed()
        • port.startSpeedForDegrees()
        • port.startSpeedForTime()
        • port.update()
        • port.writeData()
      • version
        • version.Bugfix
        • version.Build
        • version.Major
        • version.Minor
Lpf2-micropython
  • Search


© Copyright 2026, Lpf2-micropython contributors.

Built with Sphinx using a theme provided by Read the Docs.