Skip to content

Instantly share code, notes, and snippets.

'''
Large Seven-Segment Display
Python Code for controlling display with a Raspberry Pi's GPIO
Written by Amanda on electrothoughts.wordpress.com, Aug 25, 2015
For the original project visit https://electrothoughts.wordpress.com/2015/09/11/project-xl-seven-segment-display/
Please feel free to modify this code to your heart's content!
This code contains function definitions. To make your display work,
it's recommended that you run the code in the Python shell IDE as root, and execute
'''
Five-Button Melody Recorder with Raspberry Pi
2015 Amanda on wordpress.electrothoughts.com
Please reuse this code to your heart's content!
This circuit records a melody using buttons and plays the melody
back through a buzzer or 8 ohm speaker. Inspired by the game 'Music Machine'
on old electronic Merlin toy.
Components:
@mandyRae
mandyRae / oscillating_air-conditioning_fan_arduino.ino
Last active January 18, 2016 00:26
This is software for an Arduino-controlled oscillating air-conditioning fan. A fan, two potentiometers, and a servo are wired up to the Arduino. The fan is mounted to the servo, and can move in a 90 degree sweep. One pot adjusts the fan's speed, and the other adjusts the oscillation speed.
/*
Oscillating Fan with Arduino Uno -- Software
Find build instructions at www.electrothoughts.wordpress.com/2015/05/31/oscillating-fan-with-arduino-part-2/
Also see "Part 1" of this project for initial ideas at www.electrothoughts.wordpress.com/2015/05/21/oscillating-fan-with-arduino-part-1/
Amanda on Electrothoughts - 2015
Reuse this code to your heart's desire!
Components Required:
-5v micro-servo
@mandyRae
mandyRae / complex_quadratic_formula_calculator.py
Created November 18, 2015 13:32
This Python 3 program uses the quadratic formula to solve a quadratic equation. The user enters values for a, b, and c.
'''
Quadratic Equation Calculator
*Displays the equation
*Computes two real and complex solutions to standard quadratic equations
*Provides clean output
Amanda @ Electrothoughts.wordpress.com Oct 2015
Please reuse this code to your heart's content!
'''
@mandyRae
mandyRae / iopi.py
Last active December 1, 2015 14:11
This is a super simple Python module that's used for quicker access to the GPIO pins on the Raspberry Pi, mainly for use in interactive mode.
"""
iopi module ... Input/Output Pi Version 0.0
For instructions on how to install this module on
Raspberry Pi, visit https://electrothoughts.wordpress.com/2015/06/23/the-python-raspi-gpio-module-remade-iopi-py/
This is a module to simplify use of GPIO pins,
including faster setup and control
especially within interpreter/IDLE
"""
'''
PROTOTYPE SOFTWARE -- Drum Kit with Raspberry Pi
Amanda @ electrothoughts.wordpress.com 2015
Please reuse this code to your heart's content!
Notes:
- Uses pygame.mixer module to play audio files
- Uses indexing for all functions with drums and LEDs
- Some extraneous functions, such as the extra colors in pinColor
- This will run headless, so eventually the KeyboardInterrupt will be removed
@mandyRae
mandyRae / arduino_mouse_with_joystick.ino
Last active June 17, 2017 19:38
This is code to create a computer mouse using an analog joystick and computer mouse.
/*
* Analog Joystick Mouse Emulator with Arduino Micro
*
* This code turns a joystick into a computer mouse.
*
* Written by Amanda on Electrothoughts Jan 2016, with help from:
* - https://www.arduino.cc/en/Tutorial/JoystickMouseControl
* - book Exploring Arduino by Jeremy Blum: https://github.com/sciguy14/Exploring-Arduino/blob/master/Chapter%2006/mouse/mouse.ino
*
* For build instructions and background info visit www.electrothoughts.wordpress.com/2016/01/18/mouse-emulation-with-an-analog-joystick-and-arduino/
@mandyRae
mandyRae / probability_dice_sim.py
Created February 9, 2016 17:11
Dice rolling simulation to compare the number experiemental trials vs theoretical probability
'''
Experimental Probability Dice Simulator
This program serves to demonstrate how experimental probability gives
way to theoretical probability as the number of trials increases, using rolls
of a perfect, standard, cube-shaped die. In effect, it demonstrates that the
probability of rolling any number on a perfect die is:
lim x = 1/6 = 0.1666...
x -> infty
@mandyRae
mandyRae / musicalbuzzer.py
Last active January 18, 2021 03:13
Allows you to encode basic melodies and play them on piezo buzzers or speakers on the Raspberry Pi, utilizing the GPIO.PWM class
'''
Order of the Raspberry -- Amanda, Josiah, and Xavier
Group Project -- Raspberry Pi 2015-2016
Melodies and Piezo Buzzers
See below for more details on the code.
Please use this code for whatever you want!! It can be improved in a lot of ways,
and can be used for many different circuit projects!
'''
@mandyRae
mandyRae / sonar.ino
Created February 14, 2016 01:48
Sample sketch for using ultrasonic sensors with Arduino
//This sketch demonstrates how to interface with ultrasonic sensors using the Arduino and NewPing library
#include <NewPing.h>
int TRIGGER = 12;
int ECHO = 11;
//Declare a sonar object specifying the trigger and echo pins
NewPing sonar(TRIGGER, ECHO);