import luxometer
import time
import RPi.GPIO as GPIO
# Set up the Luxometer
lux = luxometer.Luxometer()
# Set up the high-intensity LEDs
GPIO.setmode(GPIO.BCM279)
GPIO.setup(GPIO.BCM279, GPIO.OUT)
# Define the threshold value for turning on/off the LEDs
threshold = 500 # Adjust this value according to your needs
while True:
# Get the light intensity in lux
lux_value = lux.estimate_lux()
# Check if the light intensity exceeds the threshold
if lux_value > threshold:
# Turn on the high-intensity LEDs
GPIO.output(GPIO.BCM279, True)
else:
# Turn off the high-intensity LEDs
GPIO.output(GPIO.BCM279, False)
# Wait for some time before checking the light intensity again
time.sleep(1)
from machine import Pin, PWM
from time import sleep
# pwm = PWM(Pin(10))
# pwm.freq(1000)
# while True:
# for duty in range(65025):
# pwm.duty_u16(duty)
# sleep(0.0001)
# for duty in range(65025, 0, -1):
# pwm.duty_u16(duty)
# sleep(0.0001)
import time
import RPi.GPIO as GPIO
# Set up the high-intensity LEDs
GPIO.setmode(GPIO.BCM279)
GPIO.setup(GPIO.BCM279, GPIO.OUT)
# Define the threshold value for turning on/off the LEDs
threshold = 500 # Adjust this value according to your needs
while True:
# Get the light intensity in lux
lux_value = lux.estimate_lux()
# Check if the light intensity exceeds the threshold
if lux_value > threshold:
# Turn on the high-intensity LEDs
GPIO.output(GPIO.BCM279, True)
else:
# Turn off the high-intensity LEDs
GPIO.output(GPIO.BCM279, False)
# Wait for some time before checking the light intensity again
time.sleep(1)