Pages: [1]   Go Down
Author Topic: i need help with working code  (Read 2324 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i made this to control my directv...but i could not figure out what frequency i should use so i made the arduino scan and it worked if i was close by but i think i may have burned out my led.... is there a problem with the code i wrote???

Code:
/*
 * IRremote: IRsendDemo - demonstrates sending IR codes with IRsend
 * An IR LED must be connected to Arduino PWM pin 3.
 * Version 0.1 July, 2009
 * Copyright 2009 Ken Shirriff
 * http://arcfn.com
 */
unsigned int rawCodes[] = {6054,1157,1220,1176,631,564,627,569,1223,572,1232,1162,1216,580,624,1169,629,1165,629};
#include <IRremote.h>

IRsend irsend;

void setup()
{
  Serial.begin(9600);
}

void loop() {
  if (Serial.read() != -1) {
    for (int i = 0; i < 3; i++) {
       delay(40);
      irsend.sendRaw(rawCodes,32,70); // Scanning...
           delay(1000);
      irsend.sendRaw(rawCodes,32,71); //
    delay(1000);
      irsend.sendRaw(rawCodes,32,72); //
       delay(1000);
      irsend.sendRaw(rawCodes,32,73); //
          delay(1000);
      irsend.sendRaw(rawCodes,32,74); //
        delay(1000);
      irsend.sendRaw(rawCodes,32,75); //
         delay(1000);
      irsend.sendRaw(rawCodes,32,76); //
          delay(1000);
      irsend.sendRaw(rawCodes,32,77); //
      delay(1000);
           irsend.sendRaw(rawCodes,32,78); //
      delay(1000);
           irsend.sendRaw(rawCodes,32,79); //
      delay(1000);
           irsend.sendRaw(rawCodes,32,80); //
     delay(1000);
        

}
  }
}
« Last Edit: April 14, 2013, 04:15:27 am by datacurve » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i am going to buy another one here soon
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

if you press CTRL-T in teh IDE the code reformats the style to make it more readable.

if (Serial.read() != -1) {

better use

if (Serial.available() > 0)
{
   int c = Serial.read();
---


Can you tell more about what you trying to accomplish, it is quite unclear from the code alone ...
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

my mother-in-law aggrivates me with the tv by turning the volume way too loud so i am trying to come up with a way to power off the box when she does so discretely. i need to figure out what freq. that would be best to use with dtv or have a better understanding of what the freq. part of the code does. the finished product will fit inside a sharpie

the part of the code i am having problems with is

Code:
irsend.sendRaw(rawCodes,32,70);

70 is the frequency

the raw code now only shows the info of the show on.which for testing is fine
i am using the serial for another project like a visual basic tv remote
« Last Edit: April 14, 2013, 02:50:34 pm by datacurve » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i need a way to have more range;
 adding another ir-led and maybe some code tweaks
Logged

Ayer, Massachusetts, USA
Offline Offline
Edison Member
*
Karma: 53
Posts: 1836
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

i made this to control my directv...but i could not figure out what frequency i should use so i made the arduino scan and it worked if i was close by but i think i may have burned out my led..
I imagine if you burned out your LED, you probably did not use the appropriate resistor.  I also imagine no matter how discrete you think you will be, you won't be, and that doing this may increase the hostilities between you and your mother-in-law even more.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i made this to control my directv...but i could not figure out what frequency i should use so i made the arduino scan and it worked if i was close by but i think i may have burned out my led..
I imagine if you burned out your LED, you probably did not use the appropriate resistor.  I also imagine no matter how discrete you think you will be, you won't be, and that doing this may increase the hostilities between you and your mother-in-law even more.

lol it can't get any worse... but it did give me a victory she thought my box was broken... lmao
« Last Edit: April 17, 2013, 12:18:39 am by datacurve » Logged

Pages: [1]   Go Up
Jump to: