Merge pull request #2702 from adafruit/guide_feedback

Updating code to CP 8
This commit is contained in:
Liz 2024-01-08 09:25:33 -05:00 committed by GitHub
commit ac9f36c19d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 7 deletions

View file

@ -8,7 +8,7 @@ import adafruit_scd4x
import sdcardio
import busio
import storage
import adafruit_pcf8523
from adafruit_pcf8523.pcf8523 import PCF8523
# setup for I2C
i2c = board.I2C() # uses board.SCL and board.SDA
@ -16,7 +16,7 @@ i2c = board.I2C() # uses board.SCL and board.SDA
# setup for SCD40
scd4x = adafruit_scd4x.SCD4X(i2c)
# setup for RTC
rtc = adafruit_pcf8523.PCF8523(i2c)
rtc = PCF8523(i2c)
# start measuring co2 with SCD40
scd4x.start_periodic_measurement()
# list of days to print to the text file on boot

View file

@ -4,27 +4,25 @@
import time
import adafruit_motor.servo
from adafruit_motor import servo
import board
import pwmio
from analogio import AnalogIn
from digitalio import DigitalInOut, Direction, Pull
pwm = pwmio.PWMOut(board.D5, frequency=50)
servo = adafruit_motor.servo.Servo(pwm)
switch = DigitalInOut(board.D7)
switch.direction = Direction.INPUT
switch.pull = Pull.UP
pot = AnalogIn(board.A0)
continuous = adafruit_motor.servo.ContinuousServo(pwm)
continuous = servo.ContinuousServo(pwm)
def val(pin):
# divides voltage (65535) to get a value between 0 and 1
return pin.value / 65535
while True:
if switch.value: