This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import smbus | |
#bus = smbus.SMBus(0) # Rev 1 Pi uses 0 | |
bus = smbus.SMBus(1) # Rev 2 Pi uses 1 | |
DEVICE = 0x20 # Device address (A0-A2) | |
IODIRA = 0x00 # Pin direction register | |
IODIRB = 0x01 # Pin direction register | |
OLATA = 0x14 # Register for outputs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |