Skip to content

Instantly share code, notes, and snippets.

Avatar

raspberrytips.nl raspberrytipsnl

View GitHub Profile
@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
@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 / 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 / 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 / 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
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()
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
@raspberrytipsnl
raspberrytipsnl / tcrt5000sensor.py
Last active Jun 13, 2017
TCRT5000 tracking sensor
View tcrt5000sensor.py
#!/usr/bin/env python
# TCRT5000 tracking sensor
# https://raspberrytips.nl/tcrt5000
import RPi.GPIO as GPIO
TrackingPin = 11
def setup():
@raspberrytipsnl
raspberrytipsnl / tripwire.py
Created Jun 20, 2017
Tripwire met laser module en lichtsensor
View tripwire.py
#!/usr/bin/env python
# Tripwire met laser module en lichtsensor
# https://raspberrytips.nl/tripwire-laser
from datetime import datetime
import RPi.GPIO as GPIO
import os, time
SensorGPIO = 23
@raspberrytipsnl
raspberrytipsnl / cpu-temp.py
Created Mar 17, 2018
Displat CPU temp on Pimoroni Four letter PHAT
View cpu-temp.py
#!/usr/bin/env python
import time
import fourletterphat
from subprocess import Popen, PIPE
print("""
Four Letter pHAT: cpu-temp.py
This example will display your Pi's CPU