Python - Fotoresistencia
En este programa se muestra como la intensidad de un foco va aumentando o disminuyendo según la cantidad de luz que reciba la fotorresistencia. import RPi.GPIO as GPIO, time from turtle import* import turtle t=Turtle() setup(550,680,0,0) title("Foco") GPIO.setmode(GPIO.BCM) t.hideturtle() t.speed(0.5) t.left(90) t.penup() t.goto(25,50) t.pendown() t.pensize(3) t.fillcolor("gray") t.begin_fill() t.fd(30) t.circle(50,180,50) t.fd(30) t.pensize(1) t.end_fill() t.right(63) t.fillcolor("white") t.begin_fill() t.circle(110,360,40) t.end_fill() while True: measurement=0 GPIO.setup(4, GPIO.OUT) GPIO.output(4, GPIO.LOW) time.sleep(0.1) GPIO.setup(4,GPIO.IN) while (GPIO.input(4)==GPIO.LOW): measurement +=1 print(measurement) if measurement<100: t.penup() t.home() t.goto(25,50) t.pendown() t.left(153) t.fillcolor("fl...