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:
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:
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.
Watch the LED and the visual circle change colors when we run the code here: