adafruit_crickit

Convenience library for using the Adafruit Crickit robotics boards.

  • Author(s): Dan Halbert

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_crickit.Crickit(seesaw: adafruit_seesaw.seesaw.Seesaw)

Represents a Crickit board. Provides a number of devices available via properties, such as servo_1. Devices are created on demand the first time they are referenced.

It’s fine to refer a device multiple times via its property, but it’s faster and results in more compact code to assign a device to a variable.

import time
from adafruit_crickit import crickit

# This is fine:
crickit.servo_1.angle = 0
time.sleep(1)
crickit.servo_1.angle = 90
time.sleep(1)

# This is slightly faster and more compact:
servo_1 = crickit.servo_1
servo_1.angle = 0
time.sleep(1)
servo_1.angle = 90
time.sleep(1)
SIGNAL1 = 2

Signal 1 terminal

SIGNAL2 = 3

Signal 2 terminal

SIGNAL3 = 40

Signal 3 terminal

SIGNAL4 = 41

Signal 4 terminal

SIGNAL5 = 11

Signal 5 terminal

SIGNAL6 = 10

Signal 6 terminal

SIGNAL7 = 9

Signal 7 terminal

SIGNAL8 = 8

Signal 8 terminal

property continuous_servo_1: adafruit_motor.servo.ContinuousServo

adafruit_motor.servo.ContinuousServo object on Servo 1 terminal

property continuous_servo_2: adafruit_motor.servo.ContinuousServo

adafruit_motor.servo.ContinuousServo object on Servo 2 terminal

property continuous_servo_3: adafruit_motor.servo.ContinuousServo

adafruit_motor.servo.ContinuousServo object on Servo 3 terminal

property continuous_servo_4: adafruit_motor.servo.ContinuousServo

adafruit_motor.servo.ContinuousServo object on Servo 4 terminal

property dc_motor_1: adafruit_motor.motor.DCMotor

adafruit_motor.motor.DCMotor object on Motor 1 terminals

property dc_motor_2: adafruit_motor.motor.DCMotor

adafruit_motor.motor.DCMotor object on Motor 2 terminals

property drive_1: adafruit_seesaw.pwmout.PWMOut

adafruit_seesaw.pwmout.PWMOut object on Drive 1 terminal, with frequency=1000

property drive_2: adafruit_seesaw.pwmout.PWMOut

adafruit_seesaw.pwmout.PWMOut object on Drive 2 terminal, with frequency=1000

property drive_3: adafruit_seesaw.pwmout.PWMOut

adafruit_seesaw.pwmout.PWMOut object on Drive 3 terminal, with frequency=1000

property drive_4: adafruit_seesaw.pwmout.PWMOut

adafruit_seesaw.pwmout.PWMOut object on Drive 4 terminal, with frequency=1000

property drive_stepper_motor: adafruit_motor.stepper.StepperMotor

adafruit_motor.motor.StepperMotor object on Drive terminals

property feather_drive_1: adafruit_seesaw.pwmout.PWMOut

adafruit_seesaw.pwmout.PWMOut object on Crickit Featherwing Drive 1 terminal, with frequency=1000

property feather_drive_2: adafruit_seesaw.pwmout.PWMOut

adafruit_seesaw.pwmout.PWMOut object on Crickit Featherwing Drive 2 terminal, with frequency=1000

property feather_drive_3: adafruit_seesaw.pwmout.PWMOut

adafruit_seesaw.pwmout.PWMOut object on Crickit Featherwing Drive 3 terminal, with frequency=1000

property feather_drive_4: adafruit_seesaw.pwmout.PWMOut

adafruit_seesaw.pwmout.PWMOut object on Crickit Featherwing Drive 4 terminal, with frequency=1000

property feather_drive_stepper_motor: adafruit_motor.stepper.StepperMotor

adafruit_motor.motor.StepperMotor object on Drive terminals on Crickit FeatherWing

init_neopixel(n: int, *, bpp: int = 3, brightness: float = 1.0, auto_write: bool = True, pixel_order: str | Tuple = None) None

Set up a seesaw.NeoPixel object

Note

On the CPX Crickit board, the NeoPixel terminal is by default controlled by CPX pin A1, and is not controlled by seesaw. So this object will not be usable. Instead, use the regular NeoPixel library and specify board.A1 as the pin.

You can change the jumper connection on the bottom of the CPX Crickit board to move control of the NeoPixel terminal to seesaw pin #20 (terminal.NEOPIXEL). In addition, the Crickit FeatherWing always uses seesaw pin #20. In either of those cases, this object will work.

from adafruit_crickit.crickit import crickit

crickit.init_neopixel(24)
crickit.neopixel.fill((100, 0, 0))
property neopixel: adafruit_seesaw.neopixel.NeoPixel

`adafruit_seesaw.neopixel object on NeoPixel terminal. Raises ValueError if init_neopixel has not been called.

property onboard_pixel: adafruit_seesaw.neopixel.NeoPixel

`adafruit_seesaw.neopixel object on the Seesaw on-board NeoPixel. Initialize on-board NeoPixel and clear upon first use.

reset() None

Reset the whole Crickit board.

property seesaw: adafruit_seesaw.seesaw.Seesaw

The Seesaw object that talks to the Crickit. Use this object to manipulate the signal pins that correspond to Crickit terminals.

from adafruit_crickit import crickit

ss = crickit.seesaw
ss.pin_mode(crickit.SIGNAL4, ss.OUTPUT)
ss.digital_write(crickit.SIGNAL4], True)
property servo_1: adafruit_motor.servo.Servo

adafruit_motor.servo.Servo object on Servo 1 terminal

property servo_2: adafruit_motor.servo.Servo

adafruit_motor.servo.Servo object on Servo 2 terminal

property servo_3: adafruit_motor.servo.Servo

adafruit_motor.servo.Servo object on Servo 3 terminal

property servo_4: adafruit_motor.servo.Servo

adafruit_motor.servo.Servo object on Servo 4 terminal

property stepper_motor: adafruit_motor.stepper.StepperMotor

adafruit_motor.motor.StepperMotor object on Motor 1 and Motor 2 terminals

property touch_1: CrickitTouchIn

adafruit_crickit.CrickitTouchIn object on Touch 1 terminal

property touch_2: CrickitTouchIn

adafruit_crickit.CrickitTouchIn object on Touch 2 terminal

property touch_3: CrickitTouchIn

adafruit_crickit.CrickitTouchIn object on Touch 3 terminal

property touch_4: CrickitTouchIn

adafruit_crickit.CrickitTouchIn object on Touch 4 terminal

class adafruit_crickit.CrickitTouchIn(seesaw: adafruit_seesaw.seesaw.Seesaw, pin: int)

Imitate touchio.TouchIn.

property raw_value: int

The raw touch measurement as an int. (read-only)

property value: bool

Whether the touch pad is being touched or not. (read-only)

adafruit_crickit.crickit = None

A singleton instance to control a single Crickit board, controlled by the default I2C pins.