Go Down

Topic: i need help with working code (Read 2738 times) previous topic - next topic

datacurve

Apr 14, 2013, 11:13 am Last Edit: Apr 14, 2013, 11:15 am by datacurve Reason: 1
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: [Select]

/*
* 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);
       

}
 }
}

datacurve

i am going to buy another one here soon

robtillaart

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 ...
Rob Tillaart

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

datacurve

#3
Apr 14, 2013, 09:44 pm Last Edit: Apr 14, 2013, 09:50 pm by datacurve Reason: 1
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: [Select]

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

datacurve

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

MichaelMeissner


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.

datacurve

#6
Apr 17, 2013, 07:14 am Last Edit: Apr 17, 2013, 07:18 am by datacurve Reason: 1


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

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy