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)

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

continuous_servo_1

adafruit_motor.servo.ContinuousServo object on Servo 1 terminal

continuous_servo_2

adafruit_motor.servo.ContinuousServo object on Servo 2 terminal

continuous_servo_3

adafruit_motor.servo.ContinuousServo object on Servo 3 terminal

continuous_servo_4

adafruit_motor.servo.ContinuousServo object on Servo 4 terminal

dc_motor_1

adafruit_motor.motor.DCMotor object on Motor 1 terminals

dc_motor_2

adafruit_motor.motor.DCMotor object on Motor 2 terminals

drive_1

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

drive_2

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

drive_3

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

drive_4

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

drive_stepper_motor

adafruit_motor.motor.StepperMotor object on Drive terminals

feather_drive_1

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

feather_drive_2

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

feather_drive_3

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

feather_drive_4

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

feather_drive_stepper_motor

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

init_neopixel(n, *, bpp=3, brightness=1.0, auto_write=True, pixel_order=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))
neopixel

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

reset()

Reset the whole Crickit board.

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)
servo_1

adafruit_motor.servo.Servo object on Servo 1 terminal

servo_2

adafruit_motor.servo.Servo object on Servo 2 terminal

servo_3

adafruit_motor.servo.Servo object on Servo 3 terminal

servo_4

adafruit_motor.servo.Servo object on Servo 4 terminal

stepper_motor

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

touch_1

adafruit_crickit.CrickitTouchIn object on Touch 1 terminal

touch_2

adafruit_crickit.CrickitTouchIn object on Touch 2 terminal

touch_3

adafruit_crickit.CrickitTouchIn object on Touch 3 terminal

touch_4

adafruit_crickit.CrickitTouchIn object on Touch 4 terminal

class adafruit_crickit.CrickitTouchIn(seesaw, pin)

Imitate touchio.TouchIn.

raw_value

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

value

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.