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
interruttore
introduction
program
apri il programma
inizia il laboratorio
algorithm
attrezzaggio
pin12
_interruptor1
pin13
_led13
variabili
X
=
0
ciclo
the variable
X
is equal at the state of the switch:
_interruptor1
IF HAPPENS THAT
X
is equal to
HIGH
SWITCH ON (5 Volt)
_led13
IF HAPPENS THAT
X
is equal to
LOW
SWITCH OFF (0 Volt)
_led13
Arduino code
//programma: interruttore //******* pin ******** //******* declare ******** const int pin_interruptor1=12;//pin of: interruttore int X=0;//declares the variable const int pin_led13=13;//pin of _led13 //********** setup ********** void setup(){ pinMode(pin_interruptor1,INPUT); pinMode(pin_led13,OUTPUT); } //********** loop ********** void loop() { X=digitalRead(pin_interruptor1); // read from _interruptor1 if(X==HIGH){ digitalWrite(pin_led13,HIGH); // HIGH/LOW is the voltage 5V/0V) } if(X==LOW){ digitalWrite(pin_led13,LOW); // HIGH/LOW is the voltage 5V/0V) } };//end loop //powered by "Arduinomio" (C) //www.mastrohora.it
copy/past in Arduino
electrical connections
here Fritzing's file
logout
Ultima modifica: Agosto 2016