How to use buttons with pros

Well for a start it’s


joystickGetDigital

An if statement needs to have its condition surrounded by parenthesis

Also that if statement needs to be under the user control task inside a while loop if you want it to work.

So your code should look like this:

if (joystickGetDigital(1, 8, JOY_UP) == 1) {
			      digitalWrite(1, HIGH);
		    } else {
                             digitalWrite(1, LOW);
                    }

Also


pinMode(1, OUTPUT);

should be in the


initializeIO()

function in the init.c file NOT the


initialize()

function

Perhaps you should look over the documentation here: http://pros.cs.purdue.edu/tutorials/

And maybe here as well: www.tutorialspoint.com/ansi_c/c_control_statements.htm

Well for a start it’s


joystickGetDigital

An if statement needs to have its condition surrounded by parenthesis

Also that if statement needs to be under the user control task inside a while loop if you want it to work.

So your code should look like this:

if (joystickGetDigital(1, 8, JOY_UP) == 1) {
			      digitalWrite(1, HIGH);
		    } else {
                             digitalWrite(1, LOW);
                    }

Also


pinMode(1, OUTPUT);

should be in the


initializeIO()

function in the init.c file NOT the


initialize()

function

Perhaps you should look over the documentation here: http://pros.cs.purdue.edu/tutorials/

And maybe here as well: www.tutorialspoint.com/ansi_c/c_control_statements.htm