Pls help,
Im trying to get a output on my arduino NANO with the digitalwrite.
but it gives my this error, only on output.
lvalue required as left operand of assignment
digitalWrite (3 = LOW);
this should put the output on pin D3 off, right?
what am i doing wrong
please help
btw: the commentary is in dutch...
int motor1 = 2; //output (links)
int motor2 = 3; //output (rechts)
int hoofdschakelaar =12; //input
int stop1 = 7; //links stopknop
int stop2 = 8; //rechts stopknop
int links = 9; //naar links
int rechts = 10; //naar rechts
int ledgroen = 4;
int ledrood = 5;
int ledblauw = 6;
void setup() {
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(hoofdschakelaar, INPUT);
pinMode(stop1, INPUT);
pinMode(stop2, INPUT);
pinMode(links, INPUT);
pinMode(rechts, INPUT);
}
void loop() {
if (hoofdschakelaar = 1) {
digitalWrite (4, HIGH); //GROENE LED
digitalWrite (5, LOW); //RODE LED
digitalWrite (2 = HIGH); //motor 1 aan
digitalWrite (3 = LOW); //motor 2 uit
if (stop1 = 1){
digitalWrite (2 = LOW);
digitalWrite (3 = HIGH);
}
if (stop2 = 1){
digitalWrite (2 = HIGH);
digitalWrite (3 = LOW);
}
if (stop2 = 0){
digitalWrite (2 = LOW);
digitalWrite (3 = LOW);
delay(10800000); //3uur wachten
}
digitalWrite (4, LOW); //GROENE LED
digitalWrite (5, HIGH); //RODE LED
}
if (links = 1) {
digitalWrite (4, HIGH); //GROENE LED
digitalWrite (5, LOW); //RODE LED
digitalWrite (2, HIGH);
digitalWrite (3, LOW);
if (stop1 = 1){
digitalWrite (2 = LOW);
digitalWrite (3 = HIGH);
}
if (stop1 = 0){
digitalWrite (2 = LOW);
digitalWrite (3 = LOW);
}
digitalWrite (4, LOW); //GROENE LED
digitalWrite (5, HIGH); //RODE LED
}
if (rechts = 1) {
digitalWrite (4, HIGH); //GROENE LED
digitalWrite (5, LOW); //RODE LED
digitalWrite (2, LOW);
digitalWrite (3, HIGH);
if (stop2 = 1){
digitalWrite (2 = HIGH);
digitalWrite (3 = LOW);
}
if (stop2 = 0){
digitalWrite (2 = LOW);
digitalWrite (3 = LOW);
}
digitalWrite (4, LOW); //GROENE LED
digitalWrite (5, HIGH); //RODE LED
}
// if (links = 1 && rechts = 1) { // 1 keer cyclus
// digitalWrite (4, HIGH); //GROENE LED
// digitalWrite (5, LOW); //RODE LED
//
// digitalWrite (2 = HIGH); //motor 1 aan
// digitalWrite (3 = LOW); //motor 2 uit
// if (stop1 = 1){
// digitalWrite (2 = LOW);
// digitalWrite (3 = HIGH);
// }
// if (stop2 = 1){
// digitalWrite (2 = HIGH);
// digitalWrite (3 = LOW);
// }
// if (stop2 = 0){
// digitalWrite (2 = LOW);
// digitalWrite (3 = LOW);
// }
// digitalWrite (4, LOW); //GROENE LED
// digitalWrite (5, HIGH) //RODE LED
// }
}