Skip to content

Instantly share code, notes, and snippets.

View Gadgetoid's full-sized avatar
🚼
+1 Baby

Philip Howard Gadgetoid

🚼
+1 Baby
View GitHub Profile
gadgetoid@superdupercomputer > ./generate-defines.py explorer-hat-pro wiringpi c
// Pin definitions for Explorer HAT Pro
// Using the wiringpi pin numbering scheme
#define EXPLORER_HAT_PRO_ADDR_ANALOG_INPUT 0x48
#define EXPLORER_HAT_PRO_ADDR_CAP_TOUCH 0x28
#define EXPLORER_HAT_PRO_CE0 10
#define EXPLORER_HAT_PRO_MISO 13
#define EXPLORER_HAT_PRO_INPUT_4 6
#define EXPLORER_HAT_PRO_SCKL 14
#define EXPLORER_HAT_PRO_LED_4 21
@Gadgetoid
Gadgetoid / touch-to-output.py
Created June 5, 2015 11:49
Toggle Explorer HAT's LEDs and outputs using the cap touch buttons
import explorerhat
import signal
def toggle_output(channel, event):
print("Got {} on channel {}".format(event, channel))
if channel < 5:
explorerhat.light[channel-1].write(event=='press')
explorerhat.output[channel-1].write(event=='press')
explorerhat.touch.pressed(toggle_output)
import explorerhat
import time
steps = [0 for x in range(16)]
G_FORWARDS = 2
G_BACKWARDS = 3
G_LEFT = 1
G_RIGHT = 4
G_PLAY = 5
@Gadgetoid
Gadgetoid / dabblet.css
Created July 5, 2013 09:22 — forked from anonymous/dabblet.css
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
.avg-navigation {
margin:0;padding:0;list-style:none;
background:#171922;
display:block;
width:830px;
height:130px;
position:relative;
@Gadgetoid
Gadgetoid / WiringPi2-Python PiGlow Tests
Created August 16, 2013 10:20
Various patterns, cross fades, fades and helpful functions for PiGlow. Hopefully to be implemented into WiringPi2-Python.
import wiringpi2 as wiringpi
from math import floor
io = wiringpi.GPIO(wiringpi.GPIO.WPI_MODE_PINS)
wiringpi.piGlowSetup(1)
def toggleAll(led,intensity):
wiringpi.piGlowLeg(0,intensity)
wiringpi.piGlowLeg(1,intensity)
wiringpi.piGlowLeg(2,intensity)
@Gadgetoid
Gadgetoid / stsmakey.py
Created January 30, 2016 11:42
Makey Makey, Explorer HAT Pro and STS-Pi together in perfect harmony
#!/usr/bin/env python
"""
You will need:
* Explorer HAT Pro
* Makey Makey
* STS-Pi
* A USB battery
Note: You will probably need to grab the latest pyusb from GitHub to make this work:
@Gadgetoid
Gadgetoid / pyruby.pb
Last active March 12, 2016 23:10
Absurdly fudgetastic method of including Python and Ruby in the same file. Will certainly break!
#!/usr/bin/env ruby
x=x\
=begin = 1
print("Hello World, I'm Python!")
'''
=end
from blinkt import set_pixel, clear, show
from time import localtime, sleep
MODE_HOUR = 0
MODE_MIN = 1
MODE_SEC = 2
time_to_stay_in_mode = 3
time_in_mode = 0
mode = 0
@Gadgetoid
Gadgetoid / gist:319ecf8e3c5d3660e298
Created December 26, 2015 11:39
Static IP raspbian jessie USB gadget
# In /etc/network/interfaces
iface usb0 inet static
dns-nameservers 8.8.8.8 8.8.4.4
address 10.0.16.16
netmask 255.255.0.0
gateway 10.0.16.32
# In /etc/dhcpcd.conf
@Gadgetoid
Gadgetoid / __init__.py
Created July 7, 2017 09:47
Unicorn HAT HD - Dual Unicorn HAT
#!/usr/bin/env python
# NOTE! This file replaces __init__.py in the Unicorn HAT HD library and allows it to drive two displays side-by-side,
# in this configuration: https://twitter.com/Gadgetoid/status/883259931478155264
# Both HATs are connected to Mini Black HAT Hack3r boards- the right board is connected directly to the Pi, and the left
# board is wired to the GPIO outputs of the right using the standard UHHD pinout: https://pinout.xyz/pinout/unicorn_hat_hd
# MISO is not needed, and the chip-select pin is jumped from BCM7 on the right header to BCM8 on the left.