Skip to content

Instantly share code, notes, and snippets.

Avatar

raspberrytips.nl raspberrytipsnl

View GitHub Profile
@raspberrytipsnl
raspberrytipsnl / lcd20x4.py
Created Apr 11, 2017
LCD scherm 20×4 met behulp van I2C aansturen
View lcd20x4.py
#!/usr/bin/python
# https://raspberrytips.nl/lcd-scherm-20x4-i2c-raspberry-pi/
import sys
import smbus
import time
import datetime
import subprocess
I2C_ADDR = 0x3F # I2C device address
View ws2801ledstrip.py
# https://raspberrytips.nl/ws2801-ledstrip/
# Simple demo script for a WS2801/SPI-like addressable RGB LED lightstrip.
import time
import RPi.GPIO as GPIO
import Adafruit_WS2801
import Adafruit_GPIO.SPI as SPI
# Configure the count of pixels:
PIXEL_COUNT = 32
View oledsystemdemo.py
import time
import sys
import subprocess
import Adafruit_GPIO.SPI as SPI
import Adafruit_SSD1306
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
View oledi2c128x32.py
import Adafruit_GPIO.SPI as SPI
import Adafruit_SSD1306
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
disp = Adafruit_SSD1306.SSD1306_128_32(rst=24)
disp.begin()
@raspberrytipsnl
raspberrytipsnl / neopixelring.py
Last active Feb 22, 2017
Demoscript NeoPixel Ring (12 led)
View neopixelring.py
# Demoscript NeoPixel Ring (12 led)
# https://raspberrytips.nl
import time
from neopixel import *
from random import randint
LEDS = 12 # Aantel LEDS
PIN = 18 # GPIO 18 / PIN 12
@raspberrytipsnl
raspberrytipsnl / rtkgpio_led.py
Created Feb 6, 2017
RTk.GPIO led example script
View rtkgpio_led.py
# https://raspberrytips.nl
# Just change:
# import RPi.GPIO as GPIO
# Into:
from RTk import GPIO
import time
@raspberrytipsnl
raspberrytipsnl / ds18b20.py
Created Feb 3, 2017
DS18B20 waterdichte temperatuur sensor aansluiten op Raspberry Pi
View ds18b20.py
#!/usr/bin/env python
# DS18B20 waterdichte temperatuur sensor aansluiten op Raspberry Pi
# https://raspberrytips.nl/ds18b20-raspberry-pi/
import os
import glob
import time
os.system('modprobe w1-gpio')
@raspberrytipsnl
raspberrytipsnl / radio.py
Created Feb 3, 2017
Internet radio Raspberry Pi + PiFace CAD
View radio.py
#!/usr/bin/env python3
# requires `mplayer` to be installed
# v1.0
# https://raspberrytips.nl/internet-radio-luisteren-raspberry-pi/
from time import sleep
import os
import sys
import signal
@raspberrytipsnl
raspberrytipsnl / gyro.py
Last active Feb 2, 2017
MPU-6050 Gyroscoop + Accelerometer
View gyro.py
#!/usr/bin/python
# Control MPU-6050 Gyroscoop + Accelerometer from Raspberry Pi
# https://raspberrytips.nl/mpu-6050-gyroscoop-raspberry-pi/
import smbus
import math
# Power management registers
power_mgmt_1 = 0x6b
@raspberrytipsnl
raspberrytipsnl / afstand.py
Last active Feb 2, 2017
HC-SR04 ultrasone sensor
View afstand.py
#!/usr/bin/env python
# Control HC-SR04 ultrasone sensor from Raspberry Pi
# https://raspberrytips.nl/hc-sr04-ultrasone-sensor/
import RPi.GPIO as GPIO #Import GPIO library
import time #Import time library
GPIO.setmode(GPIO.BCM) #Set GPIO pin numbering
TRIG = 23 #Associate pin 23 to TRIG