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
remote1
introduction
to read the value from a IR of a remote control
program
apri il programma
inizia il laboratorio
algorithm
attrezzaggio
pin0
_ricevitoreIR
pin13
_led_13
variabili
value
=
0
previous_value
=
0
ciclo
the variable
value
is equal to... read the sensor:
_ricevitoreIR
IF HAPPENS THAT
value
is not equal to
previous_value
write on the serial:
codice_tasto:
value
the variable
previous_value
is equal to
value
wait
50
milliseconds
Arduino code
//programma: remote1 //******* pin ******** //******* declare ******** #include
; //library to work with the infraredint value=0;//declares the variable int previous_value=0;//declares the variable const int pin_ricevitoreIR=0;//pin IR receiver IRrecv irrecv(pin_ricevitoreIR); //imposto il pin all'oggetto irrecv, istanza della classe IRrecv decode_results risultati;//I merged the decoding in the variable risultati const int pin_led_13=13;//pin of _led_13 //********** setup ********** void setup(){ irrecv.enableIRIn(); //enable IR receiver pinMode(pin_led_13,OUTPUT); Serial.begin(9600); // Initialize the serial } //********** loop ********** void loop() { if (irrecv.decode(&risultati)) { //controllo se il segnale di decodifica è valido value=risultati.value; //legge il valore decodificato irrecv.resume(); //rimette il ricevitore nella condizione di attesa del segnale successivo } if(value!=previous_value){ Serial.print("codice_tasto:");//writes on the serial Serial.print(value);//writes on the serial previous_value=value; } delay(50);//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