Skip to content

Commit fef35d4

Browse files
committed
crickitify
1 parent 0caecfc commit fef35d4

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

Starry_Night/starry_night.py

+9-18
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,19 @@
11
import time
2-
from busio import I2C
3-
from adafruit_seesaw.seesaw import Seesaw
4-
from adafruit_seesaw.pwmout import PWMOut
5-
from adafruit_motor import motor
6-
import board
2+
from adafruit_crickit import crickit
73

8-
# Create seesaw object
9-
i2c = I2C(board.SCL, board.SDA)
10-
seesaw = Seesaw(i2c)
4+
# Create one motor on seesaw motor port #1
5+
motor = crickit.dc_motor_1
6+
motor.throttle = 0.5 # half speed forward
117

12-
# Create one motor on seesaw PWM pins 22 & 23
13-
motor_a = motor.DCMotor(PWMOut(seesaw, 22), PWMOut(seesaw, 23))
14-
motor_a.throttle = 0.5 # half speed forward
15-
16-
# Create drive (PWM) object
17-
my_drive = PWMOut(seesaw, 13) # Drive 1 is on s.s. pin 13
18-
my_drive.frequency = 1000 # Our default frequency is 1KHz
8+
# Create drive (PWM) object for the lights on Drive 1
9+
lights = crickit.drive_1
10+
lights.frequency = 1000 # Our default frequency is 1KHz
1911

2012
while True:
21-
22-
my_drive.duty_cycle = 32768 # half on
13+
lights.fraction = 0.5 # half on
2314
time.sleep(0.8)
2415

25-
my_drive.duty_cycle = 16384 # dim
16+
lights.fraction = 0.2 # dim
2617
time.sleep(0.1)
2718

2819
# and repeat!

0 commit comments

Comments
 (0)