Advertisement
NapsterMP3

IR Enviar sinais

Jul 3rd, 2016
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. // CODIGO EM CC MODIFICADO POR NERDKINGTEAM
  2. // VISITE: nerdking.com.br
  3. // youtube.com/nerdkingteam
  4. // This sketch will send out a Nikon D50 trigger signal (probably works with most Nikons)
  5. // See the full tutorial at http://www.ladyada.net/learn/sensors/ir.html
  6. // this code is public domain, please enjoy!
  7.  
  8. int IRledPin = 13; // LED connected to digital pin 13
  9. int Botao = 8;
  10. int EstadoBotao = 0;
  11. // The setup() method runs once, when the sketch starts
  12.  
  13. void setup() {
  14. // initialize the IR digital pin as an output:
  15. pinMode(IRledPin, OUTPUT);
  16. pinMode(Botao, INPUT);
  17. digitalWrite(Botao,HIGH);
  18. Serial.begin(9600);
  19. }
  20.  
  21. void loop()
  22. {
  23. EstadoBotao = digitalRead(Botao);
  24. //Serial.println("Sending IR signal");
  25. if (digitalRead(Botao) == LOW){
  26. SendChannelUpCode();
  27. delay(500); // Altere este delay para melhores resultados
  28. }
  29. }
  30. // This procedure sends a 38KHz pulse to the IRledPin
  31. // for a certain # of microseconds. We'll use this whenever we need to send codes
  32. void pulseIR(long microsecs) {
  33. // we'll count down from the number of microseconds we are told to wait
  34.  
  35. cli(); // this turns off any background interrupts
  36.  
  37. while (microsecs > 0) {
  38. // 38 kHz is about 13 microseconds high and 13 microseconds low
  39. digitalWrite(IRledPin, HIGH); // this takes about 3 microseconds to happen
  40. delayMicroseconds(10); // hang out for 10 microseconds
  41. digitalWrite(IRledPin, LOW); // this also takes about 3 microseconds
  42. delayMicroseconds(10); // hang out for 10 microseconds
  43.  
  44. // so 26 microseconds altogether
  45. microsecs -= 26;
  46. }
  47.  
  48. sei(); // this turns them back on
  49. }
  50.  
  51. void SendChannelUpCode() {
  52.  
  53. //////////////Cole no lugar desta descrição o codigo que você coletou/////////////
  54.  
  55.  
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement