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
fading2
introduction
A fading effect. This exercise to understand the power of the variables.
program
apri il programma
inizia il laboratorio
algorithm
attrezzaggio
pin0
_yellowled
variabili
valueX
=
0
increment
=
2
ciclo
IF HAPPENS THAT
valueX
is greater than
255
the variable
increment
is equal to
-2
IF HAPPENS THAT
valueX
is less than
0
the variable
increment
is equal to
2
the variable
valueX
incremented by
increment
MODULATION
_yellowled
to the value:
valueX
wait
100
milliseconds
Arduino code
//programma: fading2 //******* pin ******** //******* declare ******** const int pin_yellowled=0;//pin of _yellowled int valueX=0;//declares the variable int increment=2;//declares the variable //********** setup ********** void setup(){ pinMode(pin_yellowled,OUTPUT); } //********** loop ********** void loop() { if(valueX>255){ increment=-2; } if(valueX<0){ increment=2; } valueX+=increment;// += means:increases its value analogWrite(pin_yellowled,valueX); delay(100);//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