pages
home
compiler
code compiler
electronics
notes about electronics
laboratory
laboratory
Processing
Processing code compiler
Theremino
Theremino code compiler
logggin
accedi o esci
tutorials Arduino
lights
my first led turns on
led's games
an electronic dice
traffic lights
candle effect
fading effect
red-green-blue 1
red-green-blue 2
7-segment display - Countdown
7-segment display bis
sensors
sensors
Sensor and serial port
sensor PIR
ultrasonic sensor
sound
Theremin
a melody
build a note
switches
buttons
keypad
input via serial port
input via serial port 2
input remote control
input remote control 2
use of variables
custom functions
servos
a robot
a remote-controlled robot
elettronica
mechanics
Italian
handbook
pins
connections
resistors
remarkable sketches
remarkable circuits
Arduino pins
error messages
tables
colour's tables
electrical simbols
referenze on-line
reference Arduino
reference Processing
link
www.arduino.cc
fritzing.org/projects
processing.org
links
hardware
base kit
facilitated kits
advanced kits
Theremino
begins the workshop
review a workshop carried out
my account
info
link
contacts
melodia
introduction
A melody
Bach, Air on the G string
program
apri il programma
inizia il laboratorio
algorithm
attrezzaggio
pin0
_altoparlante
variabili
minima
=
500
semibreve
=
1000
semiminima
=
250
croma
=
125
ciclo
PLAY the note
0 A
(55Hz) duration:
semibreve
milliseconds
PLAY the note
0 A
(55Hz) duration:
semibreve
milliseconds
PLAY the note
0 A
(55Hz) duration:
semiminima
milliseconds
PLAY the note
1 D
(73Hz) duration:
croma
milliseconds
PLAY the note
0 Bb
(58Hz) duration:
croma
milliseconds
PLAY the note
0 G
(49Hz) duration:
croma
milliseconds
PLAY the note
0 F
(44Hz) duration:
croma
milliseconds
PLAY the note
0 E
(41Hz) duration:
croma
milliseconds
PLAY the note
0 F
(44Hz) duration:
croma
milliseconds
PLAY the note
0 E
(41Hz) duration:
minima
milliseconds
PLAY the note
0 E
(41Hz) duration:
semiminima
milliseconds
PLAY the note
0 D
(37Hz) duration:
croma
milliseconds
PLAY the note
0 C
(33Hz) duration:
semibreve
milliseconds
PLAY the note
pause
(pausaHz) duration:
500
milliseconds
wait
3000
milliseconds
Arduino code
//programma: melodia //******* pin ******** //******* declare ******** int minima=500;//declares the variable int semibreve=1000;//declares the variable int semiminima=250;//declares the variable int croma=125;//declares the variable const int pin_altoparlante=0;//the longer leg is the positive and goes to pin, the other to GND //********** setup ********** void setup(){ pinMode(pin_altoparlante,OUTPUT); } //********** loop ********** void loop() { tone(pin_altoparlante,55,semibreve); tone(pin_altoparlante,55,semibreve); tone(pin_altoparlante,55,semiminima); tone(pin_altoparlante,73,croma); tone(pin_altoparlante,58,croma); tone(pin_altoparlante,49,croma); tone(pin_altoparlante,44,croma); tone(pin_altoparlante,41,croma); tone(pin_altoparlante,44,croma); tone(pin_altoparlante,41,minima); tone(pin_altoparlante,41,semiminima); tone(pin_altoparlante,37,croma); tone(pin_altoparlante,33,semibreve); noTone(pin_altoparlante); delay(3000);//attendi };//end loop //powered by "Arduinomio" (C) //www.mastrohora.it
copy/past in Arduino
electrical connections
here Fritzing's file
logout
Ultima modifica: Agosto 2016