IR send problem using Ken sheriff's library

here is the code for ken sheriff’s IR send Demo library… (read below code to see problem)

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

#include <IRremote.h>

IRsend irsend;

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

void loop() {
  if (Serial.read() != -1) {
    for (int i = 0; i < 3; i++) {
      irsend.sendSony(0xa90, 12); // Sony TV power code
      delay(100);
    }
  }
}

could someone explain what this part of the code does…

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

and i managed to make this work with my sony tv it turned it on and off :)…
i went to try this again and it did not work i am using the same code so i dont think it is that…

i am thinking it is a hardware problem… i put the IR transmitter on a digital pin and ran the blink example library, i viewed the IR through my digital camera (this works)
i moved the + pin to digital pin 3 (PWM) to then use it to control my tv but it did not work :confused: in the code it does not say what pin the IR transmitter is on is this a problem i am new to this :confused:
if a picture of the hardware would help let me know

Serial.read returns -1 if the receive buffer is empty.

sorry to be a pain i dont really understand what you just said :/ does the Serial.read part mean it reads from the serial monitor? and do i need to type somethink it the serial monitor for the IR transmitter to send the code??

Yes and yes.

this could be why it is not working :/ lmao could you tell what i have to type its probably right there in the code but i am not with it today

You can type any single character, then hit "send"

if i changed....

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

....to...

if (Serial.read() == "POWER")

would this only work if i typed power???

No, for more reasons than I've got time to put down here. Just type 'P' or 'p' and hit send.

okay thanks anyway :slight_smile: could you tell me how i could make my IR transmitter stronger

More protein in its diet.

ahha. no seriously :) could i use a transistor :/ i dont know

Well, you haven't told us the spec of your IR LED, so directions on increasing its output power will have to be ... speculative.

i dont know the specs :/

Part number? Order code? Dealer reference?

i do not have any of this :confused:
and i am currently trying to use the IR transmitter with this code…

#include <IRremote.h>

IRsend irsend;

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

void loop() {
  if (Serial.read() != -1) {
    for (int i = 0; i < 3; i++) {
      irsend.sendSony(0xa90, 12); // Sony TV power code
      delay(100);
    }
  }
}

if i just put the number 5 in the serial monitor should this turn my tv on/off

hola aca jorge desde cordoba , alguien podria ayudarme con irremote , al realizar el circuito receptor me da un codigo del tipo Encoding : UNKNOWN
Code : D5AD0B51 (32 bits) hasta ahi todo bien .
pero al abrir irsenDemo no me reconoce el codigo , no tengo mucha experiencia en programacion
me pone algo asi

/*

  • 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
    */

#include <IRremote.h>

IRsend irsend;

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

void loop() {
if (Serial.read() != -1) {
for (int i = 0; i < 3; i++) {
irsend.send UNKNOWN(0xD5AD0B51,32); // Sony TV power code
delay(40);
}
}
}
punto 1…al poner unknown tengo que separarlo con espacio si no , no cambia de color
punto 2 …al intentar compilar me sale el siguiente error

‘class IRsend’ has no member named ‘send’