Skip to content

Instantly share code, notes, and snippets.

View aitormendez's full-sized avatar

Aitor Méndez aitormendez

  • Madrid
View GitHub Profile
@aitormendez
aitormendez / conversor-mpc3008.py
Last active January 22, 2021 15:55
Para introducir valores con un potenciómetro en una Rpi 1B
View conversor-mpc3008.py
# 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
@aitormendez
aitormendez / ascensor.py
Last active November 8, 2020 09:09
Elevator stepper motor python
View ascensor.py
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