Circuit 3: RGB LED

This circuit uses a RGB LED, which can change colors based on inputted RGB (red, green, blue) values. The Arduino C code makes the RGB LED cycle through the colors red, green, blue, yellow, cyan, purple, and white, and then runs through all of the different colors by changing the RGB values.

The following diagram shows the setup of the circuit:

circuit3_diagram

Watch the following video to see the execution of the code, which makes the RGB LED change colors!

In order to convert the Arduino C to S4A, we first had to alter the setup of the circuit in order to adapt to S4A’s limitations. We moved the jumper wires connected to the RGB LED from analog pins 9, 10, and 11 to analog pins 5, 6, 9 since S4A only takes analog pin 5, 6, and 9 values.

The following diagram shows the modified circuit setup for S4A:

circuit3_diagramS4A

After converting the Arduino C to S4A and running it, the LED again shifts through the different colors. A visualization on S4A also shows the effects of the LED, which consists of a circle changing colors as the LED changes colors.

s4a_code_circuit3_rgb_led

Watch the LED and the visual circle change colors when we run the code here: 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: