Code for Starry Night Guide
CircuitPython code for Circuit Playground Express and Crickit for the Adafruit Learning System Guide Starry Night by Dano
This commit is contained in:
parent
7aeba05949
commit
b15ad4a53e
1 changed files with 28 additions and 0 deletions
28
Starry_Night/starry_night.py
Normal file
28
Starry_Night/starry_night.py
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
from busio import I2C
|
||||
from adafruit_seesaw.seesaw import Seesaw
|
||||
from adafruit_seesaw.pwmout import PWMOut
|
||||
from adafruit_motor import motor
|
||||
import board
|
||||
import time
|
||||
|
||||
# Create seesaw object
|
||||
i2c = I2C(board.SCL, board.SDA)
|
||||
seesaw = Seesaw(i2c)
|
||||
|
||||
# Create one motor on seesaw PWM pins 22 & 23
|
||||
motor_a = motor.DCMotor(PWMOut(seesaw, 22), PWMOut(seesaw, 23))
|
||||
motor_a.throttle = 0.5 # half speed forward
|
||||
|
||||
# Create drive (PWM) object
|
||||
my_drive = PWMOut(seesaw, 13) # Drive 1 is on s.s. pin 13
|
||||
my_drive.frequency = 1000 # Our default frequency is 1KHz
|
||||
|
||||
while True:
|
||||
|
||||
my_drive.duty_cycle = 32768 # half on
|
||||
time.sleep(0.8)
|
||||
|
||||
my_drive.duty_cycle = 16384 # dim
|
||||
time.sleep(0.1)
|
||||
|
||||
# and repeat!
|
||||
Loading…
Reference in a new issue