Skip to content

Instantly share code, notes, and snippets.

View ringodin's full-sized avatar

Ringotron5000 ringodin

View GitHub Profile
@ringodin
ringodin / Piezo speaker basic
Created September 6, 2015 10:11
This is for a tiny piezo speaker connected to your arduino
/*
Multiple tones from a piezo speaker
circuit:
put a small piezo speaker on digital pin 8
and then ground it
(need not be a PWM pine)
no resistor needed
modified by Ringotron5000
int pwm_a = 3; //PWM control for motor outputs 1 and 2 is on digital pin 3
int pwm_b = 11; //PWM control for motor outputs 3 and 4 is on digital pin 11
int dir_a = 12; //direction control for motor outputs 1 and 2 is on digital pin 12
int dir_b = 13; //direction control for motor outputs 3 and 4 is on digital pin 13
int val = 0; //value for fade
void setup()
{
pinMode(pwm_a, OUTPUT); //Set control pins to be outputs
/*
Arduino Mario Bros Tunes
With Piezo Buzzer and PWM
by: Dipto Pratyaksa
last updated: 31/3/13
//note that pitches.h must be included as a tab on your file
*/
#include "pitches.h"
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
int pwm_a = 3; //PWM control for motor outputs 1 and 2 is on digital pin 3
int pwm_b = 11; //PWM control for motor outputs 3 and 4 is on digital pin 11
int dir_a = 12; //direction control for motor outputs 1 and 2 is on digital pin 12
int dir_b = 13; //direction control for motor outputs 3 and 4 is on digital pin 13
int val = 0; //value for fade
const int buttonPin = 7;
void setup()
/* code for max 7219 from maxim,
reduced and optimised for using more than one 7219 in a row,
______________________________________
Code History:
--------------
The original code was written for the Wiring board by:
* Nicholas Zambetti and Dave Mellis /Interaction Design Institute Ivrea /Dec 2004
* http://www.potemkin.org/uploads/Wiring/MAX7219.txt
/* code for max 7219 from maxim,
reduced and optimised for using more than one 7219 in a row,
______________________________________
Code History:
--------------
The original code was written for the Wiring board by:
* Nicholas Zambetti and Dave Mellis /Interaction Design Institute Ivrea /Dec 2004
* http://www.potemkin.org/uploads/Wiring/MAX7219.txt
/* code for max 7219 from maxim,
reduced and optimised for using more than one 7219 in a row,
______________________________________
Code History:
--------------
The original code was written for the Wiring board by:
* Nicholas Zambetti and Dave Mellis /Interaction Design Institute Ivrea /Dec 2004
* http://www.potemkin.org/uploads/Wiring/MAX7219.txt
/* code for max 7219 from maxim,
reduced and optimised for using more than one 7219 in a row,
______________________________________
Code History:
--------------
The original code was written for the Wiring board by:
* Nicholas Zambetti and Dave Mellis /Interaction Design Institute Ivrea /Dec 2004
* http://www.potemkin.org/uploads/Wiring/MAX7219.txt
/* code for max 7219 from maxim,
reduced and optimised for using more than one 7219 in a row,
______________________________________
Code History:
--------------
The original code was written for the Wiring board by:
* Nicholas Zambetti and Dave Mellis /Interaction Design Institute Ivrea /Dec 2004
* http://www.potemkin.org/uploads/Wiring/MAX7219.txt