Toggling GPIO pin state

Forums:

Toggling the pin state turned out to be less of a challenge then I thought.
I wasn't sure on the 'read' since you are setting GPIO as OUT in initgpio but it does work.
I simply set a variable to the GPIO read, which will return a 1 or 0 and do the opposite of that state.