File tree 1 file changed +9
-18
lines changed
1 file changed +9
-18
lines changed Original file line number Diff line number Diff line change 1
1
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
7
3
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
11
7
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
19
11
20
12
while True :
21
-
22
- my_drive .duty_cycle = 32768 # half on
13
+ lights .fraction = 0.5 # half on
23
14
time .sleep (0.8 )
24
15
25
- my_drive . duty_cycle = 16384 # dim
16
+ lights . fraction = 0.2 # dim
26
17
time .sleep (0.1 )
27
18
28
19
# and repeat!
You can’t perform that action at this time.
0 commit comments