Go Down

Topic: Can't get my IR code to work! (Read 487 times) previous topic - next topic

mer7cer7

Okay its not my code (I got it from this guy Ken Shirriff
http://www.arcfn.com/2009/08/multi-protocol-infrared-remote-library.html - look at the bottom I already asked the question but trying to fix it ASAP)

Here is my problem: It'll work once every 10 tries or so (and only turns off my tv not on). I put it up to a oscilloscope (solar cell going to my computer) and I get a steady 21hz from my viewsonic remote, but my arduino program changes between 10-889hz. The sony code (from Ken Shirriff) stays at about 19-20hz (sorry don't know if its hz, mhz, or khz, too lazy to turn on my other computer to see).

CPP/H Files ::::::::::::::::::::::::::::

#define VIEWSONIC_HDR_MARK 9150
#define VIEWSONIC_HDR_SPACE 4400
#define VIEWSONIC_BIT_MARK 700
#define VIEWSONIC_ONE_SPACE 1550
#define VIEWSONIC_ZERO_SPACE 400

void IRsend::sendViewSonic(unsigned long data, int nbits)
{
enableIROut(40);
mark(VIEWSONIC_HDR_MARK);
space(VIEWSONIC_HDR_SPACE);
for (int i = 0; i < nbits; i++) {
if (data & TOPBIT) {
mark(VIEWSONIC_BIT_MARK);
space(VIEWSONIC_ONE_SPACE);
}
else {
mark(VIEWSONIC_BIT_MARK);
space(VIEWSONIC_ZERO_SPACE);
}
data <<= 1;
}
space(0);
}

Arduino File :::::::::::::::::::::::

#include <IRremote.h>

IRsend irsend;

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

void loop() {

if (Serial.read() != -1) {
for (int i = 0; i < 3; i++) {
irsend.sendViewSonic(0xC18F50AF, 32); // Viewsonic TV power code
delay(100);
}
}
}



I changed enableIROut() int (I'm assuming thats the hertzs) but still doesn't work. Am I missing something?

I have the following from the dump program:
Decoded NEC: C18F50AF (32 bits)
Raw (68): -7728 9150 -4400 700 -1500 700 -1600 700 -400 700 -400 700 -450 700 -400 750 -350 750 -1550 650 -1550 700 -450 700 -450 650 -450 700 -1550 700 -1550 700 -1550 700 -1550 700 -400 700 -1550 700 -400 700 -1550 700 -450 650 -450 750 -350 750 -400 700 -1550 700 -400 700 -1550 700 -450 650 -1600 650 -1600 700 -1550 700 -1550 700


Any ideas guys?

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