Skip to content

Instantly share code, notes, and snippets.

@aitormendez
Last active January 22, 2021 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aitormendez/99cd779cb76fe6f40676ecaf84303a1d to your computer and use it in GitHub Desktop.
Save aitormendez/99cd779cb76fe6f40676ecaf84303a1d to your computer and use it in GitHub Desktop.
Para introducir valores con un potenciómetro en una Rpi 1B
# Script para leer una señal analógica y convertirla en digital
# Raspberry Pi 1
# MCP3008
# https://cdn-shop.adafruit.com/datasheets/MCP3008.pdf
# https://youtu.be/0L6SXoQ68Z8
# https://github.com/macunixs/gpiozero-tutorials/blob/master/mcp3008.py
from gpiozero import MCP3008, PWMLED
from time import sleep
pot = MCP3008(0) # Pot is connected to CH0
led = PWMLED(25)
while True:
led.value = pot.value
sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment