Skip to content

Instantly share code, notes, and snippets.

View garethfoote's full-sized avatar

Gareth Foote garethfoote

View GitHub Profile
/*
* Sound - Using a pressure sensor to change the tone of a piezo speaker.
* @author Gareth Foote & Berit Greinke
* 12th November 2015
*
* Code adapted from here:
* https://learn.adafruit.com/trinket-gemma-mini-theramin-music-maker/code
*
* Note: The Arduino tone library does not work for the ATTiny85 on the
* Trinket and Gemma. The beep function below is similar. The beep code
/*
* Fade - Using a pressure sensor to fade an LED on.
* @author Gareth Foote & Berit Greinke
* 12th November 2015
*/
int sensorPin = 1; // The number of the input pin for the pressure sensor
int ledPin = 0; // The number of the output pin for the LED
void setup() {
int buttonPin = 2; // The number of the input pin for the button
int ledPin = 1; // The number of the output pin for the LED
int buttonState = 0; // variable for reading the pushbutton status
void setup() {
// Tell the Gemma that the LED pin is an output
pinMode(ledPin, OUTPUT);
// Tell the Gemma that the pushbutton pin Is an input
pinMode(buttonPin, INPUT);

Keybase proof

I hereby claim:

  • I am garethfoote on github.
  • I am gfte (https://keybase.io/gfte) on keybase.
  • I have a public key whose fingerprint is 9F60 B405 3223 6D23 E787 6E86 F4B5 CFE5 174C 046E

To claim this, I am signing this object:

@garethfoote
garethfoote / pitches.h
Created June 29, 2012 09:49
This currently creates an increasingly high pitched tone using a piezo element.
/*
playMelody
Appropriated from Tom Igoe's example here:
from http://arduinno.cc/en/Tutorial/Tone
Update by Gareth Foote for Arduino Projects and Workshop.
@description
This currently creates an increasingly high pitched tone
using a piezo element.