Outils pour utilisateurs

Outils du site


tpir

Ceci est une ancienne révision du document !


Solution: Configurer COM2A=00: Normal port operation, OC0A disconnected.

(voir table 18-6, p154) Configurer

  1. COM2B=00: Normal port operation, OC2B disconnected.
  2. COM2B=10: Clear OC2B on Compare Match, set OC2B at BOTTOM, (non-inverting mode).

(voir table 18-8, p155): WGM2 = 111: Fast PWM, TOP=OCRA

CS2 = 010: prescaling 1/8

Pour régler la période: OCR2A= valeur max du timer= 1)

1)
16.000.000/8)/38.000)-1 Pour régler le TON: OCR2B=OCR2A/2 </ifauth> Que faire pour autoriser la sortie PWM sur cette broche? Que faire pour empécher la sortie PWM sur cette broche? utiliser la fonction delayMicroseconds(time); Proposer l'algorithme pour la fonction void sendNECBYTE(unsigned char data) qui permet d'envoyer, bit de poids faible d'abord, les 8 bits de data. Proposer l'algorithme pour la fonction void sendNECFrame(unsigned int adr, unsigned char cmd) qui permet d'envoyer la trame NEC complète telle que visible sur le chronogramme. ==== Codage et tests ==== Utiliser une caméra de téléphone portable pour visualiser l'activité de la Led infrarouge. ==== Utilisation d'une librarie ==== ==== infrarouge==== protocole: http://www.circuitvalley.com/2013/09/nec-protocol-ir-infrared-remote-control.html arduino: http://www.righto.com/2009/08/multi-protocol-infrared-remote-library.html Hardware setup The library can use ANY of the digital input signals to receive the input from a 38KHz IR receiver module. It has been tested with the Radio Shack 276-640 IR receiver and the Panasonic PNA4602. Simply wire power to pin 1, ground to pin 2, and the pin 3 output to an Arduino digital input pin, e.g. 11. These receivers provide a filtered and demodulated inverted logic level output; you can't just use a photodiode or phototransistor. I have found these detectors have pretty good range and easily work across a room. led emettrice à connecter à PIN 3 (PWM) https://www.pjrc.com/teensy/td_libs_IRremote.html https://gist.github.com/EEVblog/6206934 http://forum.arduino.cc/index.php?topic=18230.0 http://www.build-electronic-circuits.com/arduino-remote-control/ ressources: http://techdocs.altium.com/display/FPGA/NEC+Infrared+Transmission+Protocol http://www.sbprojects.com/knowledge/ir/nec.php il faut du 950nm (j'en ai 10): http://forums.futura-sciences.com/electronique/83501-led-ir.html =====recepteur===== VISHAY - TSOP2238 - RECEPTEUR IR 38KHZ , ref farnell 4913073 datasheet: http://www.farnell.com/datasheets/30485.pdf fonctionne uniquement en alimentation 5V à terme prévoir alim en 5V et signal en sortie en 3.3 ou 5V (via vin et circuit mise à niveau) =====install librairie====
wget https://github.com/shirriff/Arduino-IRremote/archive/master.zip

dezipper dans /usr/share/arduino/libraries/IRremote
testemit.ino
#include <IRremote.h>
IRsend irsend;
void setup()
{}
byte i=0;
void loop() {
 irsend.sendNEC(0xa90, i);
 i++;
 delay(200);
}
testrcv.ino
#include <IRremote.h>
 
int RECV_PIN = A0;
int VCC_PIN = A1 ;
int GND_PIN = A2 ;
 
IRrecv irrecv(RECV_PIN);
 
decode_results results;
 
void setup()
{
  Serial.begin(9600);
  pinMode(VCC_PIN, OUTPUT);
  pinMode(GND_PIN, OUTPUT);
  digitalWrite(VCC_PIN, HIGH);
  digitalWrite(GND_PIN, LOW);
  irrecv.enableIRIn(); // Start the receiver
}
 
void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    irrecv.resume(); // Receive the next value
  }
  delay(100);
}
tpir.1427636999.txt.gz · Dernière modification : 2015/03/29 15:49 de bvandepo