This wiring
#include <IRremote.h>
#include "LowPower.h"
IRsend irsend;
const int b1 = 2;
const int b2 = 4;
const int b3 = 5;
const int b4 = 6;
const int b5 = 7;
const int b6 = 13;
int timer;
int modeCounter = 0;
void wakeUp() {
timer = 0;
}
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
pinMode(b1, INPUT);
pinMode(b2, INPUT);
pinMode(b3, INPUT);
pinMode(b4, INPUT);
pinMode(b5, INPUT);
pinMode(b6, INPUT);
}
void loop() {
attachInterrupt(0, wakeUp, HIGH);
while (timer < 10000) {
if (digitalRead(b1) == HIGH) {
timer = 0;
delay(50);
irsend.sendNEC(0xA90, 32);
}
if (digitalRead(b2) == HIGH) {
timer = 0;
delay(50);
irsend.sendNEC(0xC90, 32);
}
if (digitalRead(b3) == HIGH) {
timer = 0;
delay(50);
irsend.sendNEC(0x90, 32);
}
if (digitalRead(b4) == HIGH) {
timer = 0;
delay(50);
irsend.sendNEC(0x890, 32);
}
if (digitalRead(b5) == HIGH) {
timer = 0;
delay(50);
irsend.sendNEC(0xEFE421, 32);
}
delay(1);
timer = timer + 1;
}
LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
}
Ir reciver work
Welcome to the forum!
Try adding the Send-Pin before including the IRRemote header file at the top of your sketch
#define IR_SEND_PIN 3
#include <IRRemote.h>
Look at the examples how to send NEC codes with the current library version.
Please edit your first post and enclose the whole code inside a single "code" tag to make it readable and let us copy it.
After add ir_send_pin 3 led continuously blinking
Without any key press
amitf
May 10, 2023, 6:07am
7
Probably you have pulled up all the pins.
Post a pic of your actual connection
Temporary only 1 swtich connection.
amitf
May 10, 2023, 12:07pm
10
I was asking for pic like this ↓
vishal2248:
1 Like
amitf
May 11, 2023, 3:55am
13
Are you sure these two pins are interconnected?
Because your pins(4,5,7,13) are floating
You need to connect a pulldown resistor to pins 4,5,7
docdoc
May 11, 2023, 7:07am
14
That button looks wrong to me.
When you soldered the pins (why?) you have lost the original shape, making hard to see what are the internally connected ones:
Based on your picture, it seems to me that the connections are like the red one I have drawn:
It means the input pin is always connected to +5V so it's always HIGH, thus the LED is always on transmitting the code.
So, in this case (you have here a single button) I suspect you just need to rotate the pushbutton position by 90 degrees.
Yes, or comment out everything about any button except the one he's using for test.
amitf
May 11, 2023, 8:07am
15
Push buttons are In square shape and identical from all sides. You can't determine which pins are interconnected by seeing a pic
It can be like this
Or this
Or in any other positions
docdoc
May 11, 2023, 10:28am
16
Absolutely not. Pushbuttons are in a square case, yes, but to identificate the pins you must just look at the metallic legs: they come out from the plastic case on the same side , and no rotation can change that.
This means when looking them from the top you can clearly see pins 1 and 3 are the ones connected toghether, like 2 and 4, and you can recognize the pins despite any rotation:
For the OP, the problem could come out because he soldered some wire bits (I guess to make it easier to insert the button on the breadboard) and this makes the pins identification harder.
1 Like
Switch tested using multimeter both side ok
And all breadboard wire fitted ok
Tonight all reply testing
amitf
May 11, 2023, 2:38pm
19
If you're having trouble with external resistors, try this
#include <IRremote.h>
#include "LowPower.h"
IRsend irsend;
const int b1 = 2;
const int b2 = 4;
const int b3 = 5;
const int b4 = 6;
const int b5 = 7;
const int b6 = 11;
int timer;
int modeCounter = 0;
void wakeUp() {
timer = 0;
}
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
pinMode(b1, INPUT_PULLUP);
pinMode(b2, INPUT_PULLUP);
pinMode(b3, INPUT_PULLUP);
pinMode(b4, INPUT_PULLUP);
pinMode(b5, INPUT_PULLUP);
pinMode(b6, INPUT_PULLUP);
}
void loop() {
attachInterrupt(0, wakeUp, HIGH);
while (timer < 10000) {
if (digitalRead(b1) != HIGH) {
timer = 0;
delay(50);
irsend.sendNEC(0xA90, 32);
}
if (digitalRead(b2) != HIGH) {
timer = 0;
delay(50);
irsend.sendNEC(0xC90, 32);
}
if (digitalRead(b3) != HIGH) {
timer = 0;
delay(50);
irsend.sendNEC(0x90, 32);
}
if (digitalRead(b4) != HIGH) {
timer = 0;
delay(50);
irsend.sendNEC(0x890, 32);
}
if (digitalRead(b5) != HIGH) {
timer = 0;
delay(50);
irsend.sendNEC(0xEFE421, 32);
}
delay(1);
timer = timer + 1;
}
LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
}
Circuit diagram ↓
system
Closed
November 7, 2023, 2:38pm
20
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.