Skip to content

Instantly share code, notes, and snippets.

View jonathanprozzi's full-sized avatar
🧙‍♂️
hack the planet!

Jonathan Prozzi jonathanprozzi

🧙‍♂️
hack the planet!
View GitHub Profile
@jonathanprozzi
jonathanprozzi / classroom-noisemeter.ino
Last active August 28, 2019 08:56
Arduino Classroom Noise-o-Meter
/****************************************
Classroom Noise-o-Meter
Modified code from the Example Sound Level Sketch for the
Adafruit Microphone Amplifier
****************************************/
const int sampleWindow = 50; // Sample window width in mS (50 mS = 20Hz)
unsigned int sample;
int greenLED = 13; // choose your LEDs. helpful to descriptively label them
int yellowLED = 12;
@jonathanprozzi
jonathanprozzi / ardExp-rgbMixer.ino
Created April 1, 2017 14:39
RGB 'Mixer' with potentiometers
/*
* RGB Mixer code by Jonathan Prozzi.
* This includes Simon Monk's RGB LED code from the Adafruit lesson.
*
* There are several variables that need to be initialized.
* Remember, if you change the pins on the Arduino you
* also change the variables below.
*/
@jonathanprozzi
jonathanprozzi / ardExp-potentiometer.ino
Created April 1, 2017 14:17
(Analog input + analog output) Basic potentiometer + LED sketch.
int ledPin=9; //Variable to store pin of LED
int potentPin=A0; //Variable to store pin of potentiometer
int potentValue=0; //Variable to store last known value of potentiometer
int brightnessValue=0; //Variable to store LED brightness
void setup() {
// put your setup code here, to run once:
pinMode(ledPin, OUTPUT); //Setup LED pin for output
}
/*
This sketch is from the Adafruit Arduino series by Simon Monk.
Additional comments added by Jonathan Prozzi.
Adafruit Arduino - Lesson 13. DC Motor
*/
int motorPin = 3; // set the pin that controls the motor. this is the one that attachs to the resistor
void setup()
{
@jonathanprozzi
jonathanprozzi / ardEdu-noiseMonitor.ino
Created March 25, 2017 16:15
Code for the Noise Monitor project in the Arduino for Educators workshop.
const int sampleWindow = 50; // Sample window width in mS (50 mS = 20Hz)
unsigned int sample;
int greenLED = 13;
int yellowLED = 12;
int redLED = 11;
void setup()
{
pinMode(greenLED, OUTPUT);
pinMode(yellowLED, OUTPUT);
pinMode(redLED, OUTPUT);
@jonathanprozzi
jonathanprozzi / ardEdu-nightLight.ino
Created March 25, 2017 13:27
Basic analog input sketch for a photoresistor.
int ledPin=9; //Variable to store pin of LED
int potentPin=A0; //Variable to store pin of photoresistor
int potentValue=0; //Variable to store last known value of photoresistor
int brightnessValue=0; //Variable to store LED brightness
void setup() {
// put your setup code here, to run once:
pinMode(ledPin, OUTPUT); //Setup LED pin for output
}
// NeoPixel Ring simple sketch (c) 2013 Shae Erisson
// released under the GPLv3 license to match the rest of the AdaFruit NeoPixel library
#include <Adafruit_NeoPixel.h> // this is a library that you need to include
#ifdef __AVR__
#include <avr/power.h>
#endif
// Which pin on the Arduino is connected to the NeoPixels?
// On a Trinket or Gemma we suggest changing this to 1
@jonathanprozzi
jonathanprozzi / ArdExp-buttonBasic.ino
Created July 20, 2016 13:07
This is the basic code for controlling a LED with a pushbutton.
int ledPin = 13;
int buttonPin = 7;
int buttonState = 0;
void setup() {
// put your setup code here, to run once:
pinMode(ledPin, OUTPUT); // sets the digital pin 13 as output
pinMode(buttonPin, INPUT); // sets the digital pin 7 as input
}
@jonathanprozzi
jonathanprozzi / ardExp-trafficLight.ino
Created July 18, 2016 16:31
Traffic Light Controller - Experimenting with Arduino
/* Arduino Experimenter Challenge: Broken Traffic Light
* This traffic light is -sooo close- to being correct, but something seems
* off with the logic...
*
* Can you fix it?
*
* Hint: Think about how a functioning traffic light works and build out the logic-
* what steps should the lights go in?
* should two colors ever be on at the same time?
*
@jonathanprozzi
jonathanprozzi / servo-sketch.ino
Last active March 25, 2017 13:21
Basic Servo Sketch
/*
This sketch is modified from the 'Sweep' example sketch by BARRAGAN
and the modification by Scott Fitzgerald
*/
#include <Servo.h> //This is necessary when working with servos. It includes the servo library.
Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards