verylittlewire.device.Device

class verylittlewire.device.Device[source]

Class to control a LittleWire USB Multi-Tool.

__init__() None[source]

Finds the first Little Wire device and attaches to it.

With the help of the PyUSB find function and the constant values VENDOR_ID and PRODUCT_ID the first detectable Little Wire device is stored as USB device object in Device.lw. If no Little Wire device can be found on the USB bus, the object instantiation will be aborted with the exception ValueError.

Raises

ValueError – Little Wire device can not found on USB bus.

Return type

None

Methods

analogInit(vref)

Initialize and sets voltage reference level for all ADC channels.

analogRead(channel)

Returns the current digitized analog level of the selected ADC channel.

digitalRead(pin)

Returns the current digital level state of the selected GPIO.

digitalWrite(pin, state)

Writes a digital high or low to the selected GPIO pin.

internalPullup(pin, state)

Sets the state of the internal pull-up resistor for the selected GPIO pin.

pinMode(pin, mode)

Sets GPIO pin as input or output.

pwmInit()

Setup and initialize the PWM system.

pwmStop()

Stops all running PWM output on both channel.

pwmUpdateCompare([channelA, channelB])

Sets the PWM compare value for both channels.

pwmUpdatePrescaler([value])

Sets the PWM prescaler value (frequency) for both channels.

readFirmwareVersion()

Returns Little Wire firmware version.

readSerialNumber()

Returns Little Wire serial number.

Attributes

lw

Little Wire device object