Noob help - Basics (input and output)

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by LukeHill2015 on Fri Jan 16 16:40:20 MST 2015
Hello everyone

Ive been given a LPCExpresso 1769 board along with an experiment board.

So far i can do light sequences with little knowledge how it is actually working. Ive been looking for help and documentation/tutorials for a while not but cant find anything usefull.

Here is my code to turn on only 1 LED.

LPC_PINCON->PINSEL0 &= (~(3 << 12));

LPC_GPIO0->FIODIR |= (1 << 6);

LPC_GPIO0->FIOSET = (1 << 6); //turn on
LPC_GPIO0->FIOCLR = (1 << 6); // turn off

The confusion i have is that if i take out the FIOSET and FIOCLR line to just have

LPC_PINCON->PINSEL0 &= (~(3 << 12));

LPC_GPIO0->FIODIR |= (1 << 6);

The LED is on, i do not understand why this is as i thought FIODIR just configures the pin.
What if i wanted to configure the LED for output until a button is pressed?

Any help would be much appreciated,
Thank you