String Innkommende;
int Skallsikring1 = 1;
int Skallsikring2 = 2;
int Skallsikring3 = 3;
int UtgangAlarm = 13;
void setup() {
Serial.begin(9600);
pinMode(Skallsikring1, INPUT);
pinMode(Skallsikring2, INPUT);
pinMode(Skallsikring3, INPUT);
pinMode(UtgangAlarm, OUTPUT);
}
void loop() {
if (Serial.available()) {
if ((Skallsikring1 != LOW) || (Skallsikring2 != LOW)|| (Skallsikring3 != LOW) == HIGH){
digitalWrite(UtgangAlarm, HIGH);
Serial.print("Situasjon:");
Serial.println(7); //Whatever input status - program will always go this way???
Please use code tags (</> button on the toolbar) when you post code or warning/error messages. The reason is that the forum software can interpret parts of your code as markup, leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier to read your code and to copy it to the IDE or editor. If your browser doesn't show the posting toolbar then you can just manually add the code tags: [code]``[color=blue]// your code is here[/color]``[/code]
Using code tags and other important information is explained in the How to use this forum post. Please read it.
Please always do a Tools > Auto Format on your code before posting it. This will make it easier for you to spot bugs and make it easier for us to read. If you're using the Arduino Web Editor you will not have access to this useful tool but it's still unacceptable to post poorly formatted code. I recommend you to use the standard IDE instead.
Please remove unnecessary blank lines from your code before posting to the forum. One or two to separate code into logical sections is fine but large spaces for no reason or random blank lines just make for more scrolling when we're trying to read your code.
You've got Skallsikring defined in your code as 1 and you never change it. LOW is defined in the core as 0. 0 will never equal 1 no matter how many times you test it. So I don't see the point of this part. The same with the other three parts of that statement.
Aside from that, you really didn't say what the code was supposed to do. I will tell you now that the code absolutely does work. It does exactly as it is written to do. It's just that it isn't doing what you want it to do. If you want us to help you change that, then telling us what you want it to do seems like a pretty important detail. Don't you think?
Have you had a look at any of the example codes that come with the IDE? Try some of the basics about how to read a pin. I think you'll see your error pretty quickly.
By the way, the Serial interface uses pins 0 and 1. You can't use those for your inputs if you want to use Serial.
OK, same problem. But HIGH is defined in the core as 1 and 1 does not ever equal 2 so this one is always false. The rest are always false as well. There's no need to test whether 1 equals 2.
I would like to see how it’s wired up and if your using something that requires a pull up or a pull down resistor.
You have inputs but they may not be wired correctly or you need to use input pull-up in addition to code corrections.
Also get rid of Serial available. What do you need it for?
The reason your having an issue is because you have to monitor the state change of your inputs.
You may keep your first set of ints as they were originally but you must use a state variable and tell that to be the read of your PIN number whether the pin is 1 or 2 or whatever.
Then when you write the of statement use the state variable as your high and low. NOT THE PIN INT.