How to Program the LEDs on the Inventor Board

This lesson will go over the LEDs found on PINS(11~18)

First, begin the code by assigning Global Variable Names for the pins that you will be using. Create some space in your sketch by placing your cursor before the void setup method and pressing the enter key.

This process will assign each pin a specific variable name.

Repeat this process for pins 11 through 18, your code should resemble the following

After assigning  names for each of the pins, place your cursor inside of the void setup method, after the comment. This section will go over how to use the pinMode()function.

pinMode( )

pinMode( name of the declared pin, pin assigned as either an INPUT or OUTPUT );

When a pin is declared as an INPUT, this means that the component takes in/reads information and are generally associated with components such as sensors.

When a pin is declared as an OUTPUT, this means that the component performs an action.

Now use pinMode() to assign the first LED, LEDPIN11, as an OUTPUT.

Lights do not take in or read information, therefore it is assigned as an OUTPUT. Continue using pinMode() to assign the other pins from 12-18. The sketch should look like the following

Next, place the cursor within the method void loop(). Code created in this method will continually run once the last part of the code is executed. One should only place code here if the action is expected to be repeated.

The next section will use the function digitalWrite() and delay()

digitalWrite( );

digitalWrite( name of the declared pin, pin state either HIGH or LOW );

When an LED’s state is declared as  HIGH, the LED will turn on.

When the LED’s state is  LOW, the LED will turn off.
delay( )

delay( time in milliseconds );

delay()is a function that will define how long an action should be performed. There are 1000 milliseconds in 1 second. This means that if the action should run for 3 seconds, the time entered in the delay() should be 3000.

Final Code

Next, try turning the LEDs on and off at various times to create your own light show!