Wednesday, September 30, 2009

Pseudo Code

We just basically state that we have constant variables - one, called buttonPin, for pin 2 and one, ledPin, for pin 13.

In the void setup() we use the function pinMode to assign roles to the pins. Pin 13 will be used as an output, and pin 2 will be used as an input.

In loop() we state the variable called buttonState and at the same we assign to it the value received from input pin 2(the switch, in this case). Then we call an if function in which the puttonState is read and if equal to HIGH we call function digitalWrite to illuminate the led. If first statement not true, it will keep the LED on LOW.

1 comment: