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
conto_alla_rovescia
introduction
We have to build a bomb to blow up the school. And we need of a display that marks the countdown. On the 7-segment display numbers do appear at a distance of a second. We need to build them one by one with the various segments.
program
apri il programma
inizia il laboratorio
algorithm
attrezzaggio
pin1
_segmentA
pin2
_segmentB
pin3˜
_segmentC
pin4
_segmentD
pin5˜
_segmentE
pin6˜
_segmentF
pin7
_segmentG
variabili
ciclo
number 9
SWITCH ON (5 Volt)
_segmentA
SWITCH ON (5 Volt)
_segmentB
SWITCH ON (5 Volt)
_segmentC
SWITCH ON (5 Volt)
_segmentD
SWITCH OFF (0 Volt)
_segmentE
SWITCH ON (5 Volt)
_segmentF
SWITCH ON (5 Volt)
_segmentG
wait
1000
milliseconds
number 8
SWITCH ON (5 Volt)
_segmentA
SWITCH ON (5 Volt)
_segmentB
SWITCH ON (5 Volt)
_segmentC
SWITCH ON (5 Volt)
_segmentD
SWITCH ON (5 Volt)
_segmentE
SWITCH ON (5 Volt)
_segmentF
SWITCH ON (5 Volt)
_segmentG
wait
1000
milliseconds
number 7
SWITCH ON (5 Volt)
_segmentA
SWITCH ON (5 Volt)
_segmentB
SWITCH ON (5 Volt)
_segmentC
SWITCH OFF (0 Volt)
_segmentD
SWITCH OFF (0 Volt)
_segmentE
SWITCH OFF (0 Volt)
_segmentF
SWITCH OFF (0 Volt)
_segmentG
wait
1000
milliseconds
number 6
SWITCH ON (5 Volt)
_segmentA
SWITCH OFF (0 Volt)
_segmentB
SWITCH ON (5 Volt)
_segmentC
SWITCH ON (5 Volt)
_segmentD
SWITCH ON (5 Volt)
_segmentE
SWITCH ON (5 Volt)
_segmentF
SWITCH ON (5 Volt)
_segmentG
wait
1000
milliseconds
number 5
SWITCH ON (5 Volt)
_segmentA
SWITCH OFF (0 Volt)
_segmentB
SWITCH ON (5 Volt)
_segmentC
SWITCH ON (5 Volt)
_segmentD
SWITCH OFF (0 Volt)
_segmentE
SWITCH ON (5 Volt)
_segmentF
SWITCH ON (5 Volt)
_segmentG
wait
1000
milliseconds
number 4
SWITCH OFF (0 Volt)
_segmentA
SWITCH ON (5 Volt)
_segmentB
SWITCH ON (5 Volt)
_segmentC
SWITCH OFF (0 Volt)
_segmentD
SWITCH OFF (0 Volt)
_segmentE
SWITCH ON (5 Volt)
_segmentF
SWITCH ON (5 Volt)
_segmentG
wait
1000
milliseconds
number 3
SWITCH ON (5 Volt)
_segmentA
SWITCH ON (5 Volt)
_segmentB
SWITCH ON (5 Volt)
_segmentC
SWITCH ON (5 Volt)
_segmentD
SWITCH OFF (0 Volt)
_segmentE
SWITCH OFF (0 Volt)
_segmentF
SWITCH ON (5 Volt)
_segmentG
wait
1000
milliseconds
number 2
SWITCH ON (5 Volt)
_segmentA
SWITCH ON (5 Volt)
_segmentB
SWITCH OFF (0 Volt)
_segmentC
SWITCH ON (5 Volt)
_segmentD
SWITCH ON (5 Volt)
_segmentE
SWITCH OFF (0 Volt)
_segmentF
SWITCH ON (5 Volt)
_segmentG
wait
1000
milliseconds
number 1
SWITCH OFF (0 Volt)
_segmentA
SWITCH ON (5 Volt)
_segmentB
SWITCH ON (5 Volt)
_segmentC
SWITCH OFF (0 Volt)
_segmentD
SWITCH OFF (0 Volt)
_segmentE
SWITCH OFF (0 Volt)
_segmentF
SWITCH OFF (0 Volt)
_segmentG
wait
1000
milliseconds
number 0
SWITCH ON (5 Volt)
_segmentA
SWITCH ON (5 Volt)
_segmentB
SWITCH ON (5 Volt)
_segmentC
SWITCH ON (5 Volt)
_segmentD
SWITCH ON (5 Volt)
_segmentE
SWITCH ON (5 Volt)
_segmentF
SWITCH OFF (0 Volt)
_segmentG
wait
1000
milliseconds
Arduino code
//programma: conto_alla_rovescia //******* pin ******** //******* declare ******** const int pin_segmentA=1;//pin of _segmentA const int pin_segmentB=2;//pin of _segmentB const int pin_segmentC=3;//pin of _segmentC const int pin_segmentD=4;//pin of _segmentD const int pin_segmentE=5;//pin of _segmentE const int pin_segmentF=6;//pin of _segmentF const int pin_segmentG=7;//pin of _segmentG //********** setup ********** void setup(){ pinMode(pin_segmentA,OUTPUT); pinMode(pin_segmentB,OUTPUT); pinMode(pin_segmentC,OUTPUT); pinMode(pin_segmentD,OUTPUT); pinMode(pin_segmentE,OUTPUT); pinMode(pin_segmentF,OUTPUT); pinMode(pin_segmentG,OUTPUT); } //********** loop ********** void loop() { //****************number_9**************** digitalWrite(pin_segmentA,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentB,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentC,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentD,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentE,LOW); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentF,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentG,HIGH); // HIGH/LOW is the voltage 5V/0V) delay(1000);//attendi //****************number_8**************** digitalWrite(pin_segmentA,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentB,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentC,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentD,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentE,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentF,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentG,HIGH); // HIGH/LOW is the voltage 5V/0V) delay(1000);//attendi //****************number_7**************** digitalWrite(pin_segmentA,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentB,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentC,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentD,LOW); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentE,LOW); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentF,LOW); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentG,LOW); // HIGH/LOW is the voltage 5V/0V) delay(1000);//attendi //****************number_6**************** digitalWrite(pin_segmentA,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentB,LOW); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentC,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentD,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentE,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentF,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentG,HIGH); // HIGH/LOW is the voltage 5V/0V) delay(1000);//attendi //****************number_5**************** digitalWrite(pin_segmentA,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentB,LOW); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentC,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentD,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentE,LOW); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentF,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentG,HIGH); // HIGH/LOW is the voltage 5V/0V) delay(1000);//attendi //****************number_4**************** digitalWrite(pin_segmentA,LOW); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentB,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentC,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentD,LOW); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentE,LOW); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentF,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentG,HIGH); // HIGH/LOW is the voltage 5V/0V) delay(1000);//attendi //****************number_3**************** digitalWrite(pin_segmentA,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentB,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentC,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentD,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentE,LOW); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentF,LOW); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentG,HIGH); // HIGH/LOW is the voltage 5V/0V) delay(1000);//attendi //****************number_2**************** digitalWrite(pin_segmentA,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentB,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentC,LOW); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentD,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentE,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentF,LOW); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentG,HIGH); // HIGH/LOW is the voltage 5V/0V) delay(1000);//attendi //****************number_1**************** digitalWrite(pin_segmentA,LOW); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentB,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentC,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentD,LOW); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentE,LOW); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentF,LOW); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentG,LOW); // HIGH/LOW is the voltage 5V/0V) delay(1000);//attendi //****************number_0**************** digitalWrite(pin_segmentA,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentB,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentC,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentD,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentE,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentF,HIGH); // HIGH/LOW is the voltage 5V/0V) digitalWrite(pin_segmentG,LOW); // HIGH/LOW is the voltage 5V/0V) delay(1000);//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