Atmega328P-PU IR Libary?.

Hello, I am trying to use the Atmega328P-PU as a standalone with a crystial oscillator to make a TV remote but I have a problem. I cannot get the IR led to send any signals! my wiring is %100 right! Can the Atmega328P-PU not support the libary I am using? this is my code:

<>
//pin 7 is a LED for testing.

Thank you. :slight_smile:

#include <IRremote.h>
#include <IRremoteInt.h>

IRsend sender;
void setup() {

 Serial.begin(9600);

 pinMode(4, INPUT_PULLUP);
 pinMode(7, OUTPUT);

}

void loop() {

 int sensorVal = digitalRead(4);


 if (sensorVal == LOW) {
   digitalWrite(7, LOW);
   sender.sendNEC(0xE0E040BF, 32);
   delay(40);
 } else {
   digitalWrite(7, HIGH );
 }
}

Please edit you post to include code-tags please.

Phil-Henrich: I cannot get the IR led to send any signals!

Why do you think so? How dit you check?

Phil-Henrich: my wiring is %100 right!

Then show it, we're all non-believers...

But f it works on an Uno (and I'm pretty sure the library does) it should work on a stand alone ATmega328p because the Uno is nothing more then a ATmega328p on a board.

Did you burn the bootloader and/or set fuses?

Does a simple blink-sketch work?

septillion: Why do you think so? How dit you check?

My IR led works fine when I am using digitalWrite(pinOfIRled, HIGH)to test my connections and code but when I replace the code with sendNEC the IRled doesnt light up(I am using a phone camera to check it), which leaves me a bit confused.

septillion: Did you burn the bootloader and/or set fuses?

I have used the chip from an arduino so it has a bootloader on it already. and yes a blink sketch works on it :)

With a phone the IR when sending a code can be very hard to see.

And the timing is correct of the blink? Aka, you use a 16MHz crystal?

But that still leaves me a non-believer ;)

non-believer here too.

.

septillion: But that still leaves me a non-believer ;)

Hahah I am sorry.... But I can't do much about that.

septillion: And the timing is correct of the blink? Aka, you use a 16MHz crystal?

I actually have no clue what Mhz my crystal is... I found it in an old mouse and have just used it and it worked! could this be the problem?

Yes

Indeed it can. Most crystals are pretty damn clear marked.

And about the believing part, draw a schematic. A hand drawing will do. And include a couple of photos of the circuit.

Put the IR LED on pin 3.