Hello experts
I have this weird problem with my relay project
I have 9 different inputs, they are supposed to turn on and off either one or both of the relays
However...
When I add more functions than two in the programming, the relays will not activate, and will instead just emit light from the status LEDS
It is a "standard" dual LED relay board, and in itself i works well
if I only have one function in the code, then there is no problem, if i add a function more, the "click" from the relays are dimmer
if I add even more (more than two), the relays will not even give a "click" sound but just emit a dim light from the status LEDS
It should be said, I have very little programming skills, and because of the problem escalates, depending of lines of code the I will assume the problem is in the coding
The circuit is quite large, but all input/outputs have been tried individually to rule out a bad or floating input/output with no problem, several power supply's have also been tried, with no different result
I really need some help, thank you
I do hope I have put this under the right segment
There are right now 4 of what I describe as functions
They are called "knap" it means button in danish, and that also will explain if my english writing might be a little off
const int LEDPin1 = 5;
const int relayPin1 = 2;
const int relayPin2 = 11;
const int buttonPin1 = A0;
const int buttonPin2 = A1;
const int buttonPin3 = A2;
const int buttonPin4 = A3;
const int buttonPin5 = A4;
const int buttonPin6 = A5;
int buttonState = 0;
void setup() {
pinMode(relayPin1, OUTPUT);
pinMode(relayPin2, OUTPUT);
pinMode(buttonPin1, INPUT);
pinMode(buttonPin2, INPUT);
pinMode(buttonPin3, INPUT);
pinMode(buttonPin4, INPUT);
pinMode(buttonPin5, INPUT);
pinMode(buttonPin6, INPUT);
}
void loop() {
//Motorstart
buttonState = digitalRead(buttonPin4);
if (buttonState == HIGH) {
digitalWrite(relayPin1, LOW);
digitalWrite(relayPin2, LOW);
digitalWrite(LEDPin1, HIGH);
}
else {
digitalWrite(relayPin1, HIGH);
digitalWrite(relayPin2, HIGH);
digitalWrite(LEDPin1, LOW);
}
//Motorstart
//Knap 1
buttonState = digitalRead(buttonPin1);
if (buttonState == HIGH) {
digitalWrite(relayPin1, LOW);
digitalWrite(relayPin2, LOW);
}
else {
digitalWrite(relayPin1, HIGH);
digitalWrite(relayPin2, HIGH);
}
//Knap 1
//Knap 2
buttonState = digitalRead(buttonPin2);
if (buttonState == HIGH) {
digitalWrite(relayPin1, LOW);
digitalWrite(relayPin2, LOW);
}
else {
digitalWrite(relayPin1, HIGH);
digitalWrite(relayPin2, HIGH);
}
//Knap 2
//Knap 3
buttonState = digitalRead(buttonPin3);
if (buttonState == HIGH) {
digitalWrite(relayPin1, LOW);
digitalWrite(relayPin2, LOW);
}
else {
digitalWrite(relayPin1, HIGH);
digitalWrite(relayPin2, HIGH);
}
//Knap 3
//Knap 4
buttonState = digitalRead(buttonPin4);
if (buttonState == HIGH) {
digitalWrite(relayPin1, LOW);
digitalWrite(relayPin2, LOW);
}
else {
digitalWrite(relayPin1, HIGH);
digitalWrite(relayPin2, HIGH);
}
//Knap 4
}