Class CRICKITHat
-
- All Implemented Interfaces:
-
com.diozero.api.DeviceInterface
,java.lang.AutoCloseable
public final class CRICKITHat implements DeviceInterface
A device factory for the AdaFruit CRICKIT.
It is HIGHLY recommended to use the convenience functions instead of creating devices via the builders or constructors as the pin numbering gets a little odd.
-
-
Field Summary
Fields Modifier and Type Field Description private final AdafruitSeeSaw
seeSaw
-
Constructor Summary
Constructors Constructor Description CRICKITHat(I2CDevice i2CDevice, Boolean initReset)
CRICKITHat(I2CDevice i2CDevice)
CRICKITHat()
CRICKITHat(AdafruitSeeSaw seeSaw)
-
Method Summary
Modifier and Type Method Description final AdafruitSeeSaw
getSeeSaw()
final DigitalInputDevice
signalDigitalIn(Integer pin)
Convenience function to get a digital input on the Signal port pin (1-8). final DigitalOutputDevice
signalDigitalOut(Integer pin)
Convenience function to get a digital output on the Signal port pin (1-8) final AnalogInputDevice
signalAnalogIn(Integer pin)
Convenience function to get an analog input on the Signal port pin (1-8) final DigitalInputDevice
touchDigitalIn(Integer pin)
Convenience function to get a digital input on one of the touchpads. final AnalogInputDevice
touchAnalogIn(Integer pin)
Convenience function to get an analog input on one of the touchpads. final ServoDevice
servo(Integer pin, ServoTrim servoTrim)
Convenience function to get a servo device on the Servo ports pin (1-4) final PwmMotor
motor(Integer index)
Convenience function to use the Motor ports for bidirectional motors, where index is the motor number (1 or 2). final PwmOutputDevice
drive(Integer index)
Convenience function to get PWM-able outputs. final BasicStepperController
unipolarStepperPort()
Get the unipolar stepper controller from the DRIVE
ports.final BasicStepperController
motorStepperPort()
Get a controller from the motor ports. final NeoPixel
neoPixel(Integer numPixels, Integer bitsPerPixel)
Convenience function to use the NeoPixel port. final NeoPixel
statusPixel()
Convenience function to access the on-board status NeoPixel. Unit
close()
-
-
Constructor Detail
-
CRICKITHat
CRICKITHat(I2CDevice i2CDevice, Boolean initReset)
-
CRICKITHat
CRICKITHat(I2CDevice i2CDevice)
-
CRICKITHat
CRICKITHat()
-
CRICKITHat
CRICKITHat(AdafruitSeeSaw seeSaw)
-
-
Method Detail
-
getSeeSaw
final AdafruitSeeSaw getSeeSaw()
-
signalDigitalIn
final DigitalInputDevice signalDigitalIn(Integer pin)
Convenience function to get a digital input on the Signal port pin (1-8). This uses GpioPullUpDown.PULL_UP so the inputs are reversed from what one would expect.
-
signalDigitalOut
final DigitalOutputDevice signalDigitalOut(Integer pin)
Convenience function to get a digital output on the Signal port pin (1-8)
-
signalAnalogIn
final AnalogInputDevice signalAnalogIn(Integer pin)
Convenience function to get an analog input on the Signal port pin (1-8)
-
touchDigitalIn
final DigitalInputDevice touchDigitalIn(Integer pin)
Convenience function to get a digital input on one of the touchpads.
-
touchAnalogIn
final AnalogInputDevice touchAnalogIn(Integer pin)
Convenience function to get an analog input on one of the touchpads.
-
servo
final ServoDevice servo(Integer pin, ServoTrim servoTrim)
Convenience function to get a servo device on the Servo ports pin (1-4)
-
motor
final PwmMotor motor(Integer index)
Convenience function to use the Motor ports for bidirectional motors, where index is the motor number (1 or 2). Note this is 5v.
-
drive
final PwmOutputDevice drive(Integer index)
Convenience function to get PWM-able outputs. Note this is 5v.
-
unipolarStepperPort
final BasicStepperController unipolarStepperPort()
Get the unipolar stepper controller from the
DRIVE
ports. Note this is 5v.
-
motorStepperPort
final BasicStepperController motorStepperPort()
Get a controller from the motor ports. Note this is 5v.
-
neoPixel
final NeoPixel neoPixel(Integer numPixels, Integer bitsPerPixel)
Convenience function to use the NeoPixel port. Note that this is not a
diozero
WS2811 but an implementation from this library.
-
statusPixel
final NeoPixel statusPixel()
Convenience function to access the on-board status NeoPixel. Note that this is not a
diozero
WS2811 but an implementation from this library.
-
-
-
-