Hardware Guy in Software Jam - HELP !!!

I have a simple project using an Uno - I have 4 momentary-contact buttons and one output to a relay. I need to read the most recent button press to jump to a subroutine for relay on-off patterns. One button would switch the relay off, the second would cycle the relay on and off in a pseudo-random pattern, the third would cycle the relay on and off in 2-second intervals, the fourth would hold the relay constant on. The buttons need to be able to change modes while in the longest run of the pseudo-random pattern

Hardware is solid and tests good - just haven't mastered the best way to make the code work. All help greatly appreciated !!!

just haven't mastered the best way to make the code work

You have some code, though, right? Otherwise, your comment about the hardware is useless. Post your code, not a useless poll.

I've been trying to set a variable so I can jump to a function - can't get past the digitalread without error.

// set pin numbers: const int pbPinOff = 2; // the number of the pushbutton pin Off Mode const int pbPinRdm = 3; // the number of the pushbutton pin Random Mode const int pbPin2cyc = 4; // the number of the pushbutton pin 2-On/2-Off Mode const int pbPinOn = 5; // the number of the pushbutton pin Constant On Mode const int Relay = 7; // the number of the LED pin

// variables will change: int pbStat = 0; // variable for reading the pushbutton status int Smode = 0; //variable to set mode int Hmode = 0; //variable to Hold mode

void setup() { // initialize the LED pin as an output: pinMode(Relay, OUTPUT); // initialize the pushbutton pin as an input: pinMode(pbPinOff, INPUT); pinMode(pbPinRdm, INPUT); pinMode(pbPin2cyc, INPUT); pinMode(pbPinOn, INPUT);

}

void loop() {

if (digitalread(pbPinOff)== high); Smode == 1

if Smode)(Hmode == 1)) ; // check if the pushbutton is pressed. // if it is, the buttonState is HIGH: // turn LED on: if (Hmode == 1) digitalWrite(Relay, HIGH); } else { // turn LED off: digitalWrite(Relay, LOW); } }

if (digitalread(pbPinOff)== high);

Several problems, here. HIGH is a keyword. high is not. The semicolon on the end is the body of the if statement. It says that if the statement is true, do nothing. Else, do nothing. Is that what you want?

Smode == 1

All statements need to end with a semicolon, unless the statement allows for a block of code, as an if statement does. There is no semicolon here. The == is the equality (test) operator, not the assignment (=) operator.

if Smode)(Hmode == 1)) ;

One open paren and three close parens. Way out of balance. There's that semicolon on the end, too.

Open curly braces go on a new line. The Tools + Auto format menu item would be a good thing to become intimately familiar with, too. It helps make the structure of your code easier to see and follow.

I've been trying to set a variable so I can jump to a function

By the way, you can't "jump to a function". You call a function.