i was possibly thinking wrong when i described the problem, (motorstaus7=1) has to be true only when (motorstate7 == LOW) and motorstate 2,3 and 4 is not HIGH.
In this coin game there is 30V DC that is daisy chained trough all the switches, 30V on Common, then out on NC to common on the next switch and so on. Switch 2, 3 and 4 has a wire from NO to different inputs on the Arduino trough voltage dividers that gives 4,15V on the input pins. the problem is the switch for the 7 NKR win, this switch does not have a wire on the NO pin. so the end of the daisy chained switches is the input on the Arduino for the 7 NKR win switch. The problem is that all the switches makes that input go LOW.
schematic of the switches
Lars Berg Brytere.pdf (65.6 KB)
Schematic of the old circuit board with a mechanical counter relay
Capri kretskort.pdf (75.7 KB)
Here is a Youtube video when i just made a code to test the relay outputs
here is the code
const int kr2 = 3;
const int kr3 = 4;
const int kr4 = 5;
const int kr7 = 6;
const int kam = 2;
const int motor = 7;
const int gteller = 8;
// setter verdien som skal trekkes fra av kam ved gevinst
int kr2value = 2;
int kr3value = 3;
int kr4value = 4;
int kr7value = 7;
int motorstatus2 = 0;
int motorstate2 = 0;
int camstate2 = 0;
int camstatus2 = 0;
int motorstatus3 = 0;
int motorstate3 = 0;
int camstate3 = 0;
int camstatus3 = 0;
int motorstatus4 = 0;
int motorstate4 = 0;
int camstate4 = 0;
int camstatus = 0;
int motorstatus7 = 0;
int motorstate7 = 0;
int camstate7 = 0;
int camstatus7 = 0;
void setup() {
// put your setup code here, to run once:
pinMode(motor, OUTPUT);
digitalWrite(motor, LOW);
pinMode(gteller, OUTPUT);
digitalWrite(gteller, LOW);
pinMode(kr2, INPUT);
pinMode(kr3, INPUT);
pinMode(kr4, INPUT);
pinMode(kr7, INPUT);
pinMode(kam, INPUT);
}
void loop() {
// kr2 utbetalings sekvens
motorstate2 = digitalRead(kr2);
if (motorstate2 == HIGH){
motorstatus2 = 1;
}
if (motorstatus2 == 1){
digitalWrite(motor, HIGH);
delay(100);
}
camstate2 = digitalRead(kam);
if (camstate2 == LOW){
kr2value --;
} else {kr2value == kr2value;
}
if (kr2value == 0){
motorstatus2 = 0;
}
if (motorstatus2 == 0){
digitalWrite(motor, LOW);
kr2value = 2;
}
// kr3 utbetalings sekvens
motorstate3 = digitalRead(kr3);
if (motorstate3 == HIGH){
motorstatus3 = 1;
}
if (motorstatus3 == 1){
digitalWrite(motor, HIGH);
delay(100);
}
camstate3 = digitalRead(kam);
if (camstate3 == LOW){
kr3value --;
} else {kr3value == kr3value;
}
if (kr3value == 0){
motorstatus3 = 0;
}
if (motorstatus3 == 0){
digitalWrite(motor, LOW);
kr3value = 3;
}
// kr4 utbetalings sekvens
motorstate4 = digitalRead(kr4);
if (motorstate4 == HIGH){
motorstatus4 = 1;
}
if (motorstatus4 == 1){
digitalWrite(motor, HIGH);
delay(100);
}
camstate4 = digitalRead(kam);
if (camstate4 == LOW){
kr4value --;
} else {kr4value == kr4value;
}
if (kr4value == 0){
motorstatus4 = 0;
}
if (motorstatus4 == 0){
digitalWrite(motor, LOW);
kr4value = 4;
Serial.println(kr4value);
}
// kr7 utbetalings sekvens
motorstate7 = digitalRead(kr7);
if ((motorstate7 == LOW) && (motorstate2 == LOW) && (motorstate3 == LOW) && (motorstate4 == LOW)){
motorstatus7 = 1;
}
if (motorstatus7 == 1){
digitalWrite(motor, HIGH);
delay(100);
}
camstate7 = digitalRead(kam);
if (camstate7 == LOW){
kr7value --;
} else {kr7value == kr7value;
}
if (kr7value == 0){
motorstatus7 = 0;
}
if (motorstatus7 == 0){
digitalWrite(motor, LOW);
kr7value = 7;
Serial.println(kr7value);
}
}