Skip to content

Instantly share code, notes, and snippets.

View raspberrytipsnl's full-sized avatar

raspberrytips.nl raspberrytipsnl

View GitHub Profile
@raspberrytipsnl
raspberrytipsnl / laser.py
Last active February 1, 2021 11:44
Laser module python script (Raspberry Pi)
#!/usr/bin/env python
# Control Lasermodule from Raspberry Pi
# https://raspberrytips.nl/laser-module-aansturen-via-gpio/
import RPi.GPIO as GPIO
import time
LaserGPIO = 17 # --> PIN11/GPIO17
@raspberrytipsnl
raspberrytipsnl / afstand.py
Last active February 2, 2017 13:55
HC-SR04 ultrasone sensor
#!/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 August 18, 2023 01:37
MPU-6050 Gyroscoop + Accelerometer
#!/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 February 3, 2017 12:45
Internet radio Raspberry Pi + PiFace CAD
#!/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 / ds18b20.py
Created February 3, 2017 12:55
DS18B20 waterdichte temperatuur sensor aansluiten op Raspberry Pi
#!/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 / rtkgpio_led.py
Created February 6, 2017 14:38
RTk.GPIO led example script
# https://raspberrytips.nl
# Just change:
# import RPi.GPIO as GPIO
# Into:
from RTk import GPIO
import time
@raspberrytipsnl
raspberrytipsnl / neopixelring.py
Last active February 22, 2017 10:14
Demoscript NeoPixel Ring (12 led)
# 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
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()
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 / ws2801ledstrip.py
Created March 19, 2017 13:43
WS2801 ledstrip demo
# 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