Programing issues

hey guys first time poster and I need some help. this is my first arduino project im working on and im getting these errors when I verify/compile my script. I try to fix one thing and it seams like 2 more errors come up. Any help or point in the right direction would be greatly appreciated.

updated_system.ino: In function 'void loop()': updatedsystem.ino:36:18: error: request for member 'uniquePress' in 'buttonPin1', which is of non-class type 'const int' updatedsystem.ino:42:18: error: request for member 'uniquePress' in 'buttonPin2', which is of non-class type 'const int' updatedsystem.ino:47:3: error: 'else' without a previous 'if' updated_system.ino:48:29: error: 'digitalwrite' was not declared in this scope Error compiling.

// constants won't change. They're used here to // set pin numbers: const int buttonPin1 = 2; // the number of the pushbutton to pin 2 const int buttonPin2 = 4; // the number of the pushbutton to pin 4 const int relay1 = 7; // the number of the relay3 to pin 7 const int relay2 = 8; // the number of the relay4 to pin 8 const int ledPin = 13; // the number of the LED pin

// variables will change: int buttonState1 = 0; // variable for reading the pushbutton status int buttonState2 = 0;

void setup() {

// initialize the pushbutton pin as an input: pinMode(buttonPin1, INPUT); // initialize the pushbutton pin as an input: pinMode(buttonPin2, INPUT); // initialize the relay pin as an output: pinMode(relay1, OUTPUT); // initialize the relay pin as an output: pinMode(relay2, OUTPUT); }

void loop(){ // read the state of the pushbutton value: buttonState1 = digitalRead(buttonPin1); // read the state of the pushbutton value: buttonState2 = digitalRead(buttonPin2);

// check whether a pushbutton is pressed. // if it is, the buttonState is HIGH:

if (buttonPin1.uniquePress) (buttonState1 == HIGH);{ //you need to release this button in order for it to trigger again // turn relay on: digitalWrite(relay1, HIGH); delay(10000); // wait for ten second }

if (buttonPin2.uniquePress)(buttonState2 == HIGH);{ //you need to release this button in order for it to trigger again // turn relay on: digitalWrite(relay2, HIGH); delay(10000); // wait for ten second } else { digitalwrite(relay1, LOW); digitalwrite(relay2, LOW); } }

 if (buttonPin1.uniquePress)

You have not #included the Button library or created a button instance named buttonpin1 hence you cannot use the uniquePress method

   digitalwrite(relay1, LOW);
    digitalwrite(relay2, LOW);

Capital W needed

EvoX: thanks for the help here is the new script

It's not script. Script languages are interpreted. It's "code" or "source code".

Are your relays energized when you reset the Arduino (in other words, with a different sketch loaded, like Blink Without Delay)? If so it has to do with the hardware connection to your relays.

I just loaded the blink sketch and the power is off to the relays. did I mess something up with my high/low codes?

}
  else (buttonState1 == LOW);
       (buttonState2 == LOW);{
    
    digitalWrite(relay1, LOW);
    digitalWrite(relay2, LOW);
  }

is all wrong, maybe you meant:

}
  else if (buttonState1 == LOW || buttonState2 == LOW)
{
    
    digitalWrite(relay1, LOW);
    digitalWrite(relay2, LOW);
  }

...or something like that.

  if (buttonState1 == HIGH){  
    // turn relay on:
    digitalWrite(relay1, HIGH);
    delay(10000);  
        // wait for ten second
  }

  if (buttonState2 == HIGH){  
    // turn relay on:
    digitalWrite(relay2, HIGH);
    delay(10000);    
        // wait for ten second
  }
  else (buttonState1 == LOW);
       (buttonState2 == LOW);{
    
    digitalWrite(relay1, LOW);
    digitalWrite(relay2, LOW);
  }
}

Ok. This is why we indent our code properly: the arduino IDE badly, badly needs a pretty print function.

The C compiler will read this piece of code like this:

  if (buttonState1 == HIGH){  
    // do stuff
  }

  if (buttonState2 == HIGH){  
    // do stuff
  }
  else 
    (buttonState1 == LOW);

  (buttonState2 == LOW);

  {
    // do stuff
  }
}

First, there is no else/if after the first condition, which means that one of the two branches of the second if will get exectuted irrespective of whether or not button 1 was pressed.

Second, '(buttonState1 == LOW);' is being treated as a statement (which incidentally does nothing) and the statements after it get executed unconditionally. What you probably wanted was for those two lines to be comments, so stick a '//' in front of them.