![]() ![]() The Code //Showing the shades of RGB and R, G, B LED demo Step 7 − Compile the program using the play button on Wokwi. Step 6 − Write the C program using the Wokwi code area on the left. Step 5 − Assuming that the second leg of the LED is the longest (-ve ), connect the first pin of RGB to the red-led positive line, the third pin to the green led the positive line, and the fourth pin to the blue-led positive line, as shown in Fig 2. Connect the smaller legs of LEDs to Uno's GND and the other lines to Uno pins (3, 5, 6) Step 4 − Use three red, green, and blue LEDs. Step 3 − Attach the longest leg of RGB Led to Uno’s GND. Step 2 − Put an RGB led on the virtual circuit area using the + sign. Start a new ArduinoUno project on Wokwi Simulator. The wokwi link is given here -Īfter login into wokwi, Use an Arduino Uno Project.įirst, make the circuit in the right side area and write the code using C language in the left side code area as shown in the fig no.2 Circuit Design Steps and Coding It is an easy to use and free service to start with learning IOT. Wokwi is an online place where virtual circuits can be made and programs to control these circuits can be written and then the results can be tested. ![]() RGB_Color(255, 40, 40) //Showing the shade of deep pink colorįig 1: The actual circuit needed for the program and the result showing different colors and shades on RGB led Example 2: Using RGB led with ArduinoUno on Wokwi RGB_Color(255, 20, 147) //Showing the shade of deep pink color RGB_Color(255, 50, 255) //Showing the shade of magenta color ![]() RGB_Color(19, 255, 255) //Showing the shade of cyan color RGB_Color(255, 255, 10) //Showing the shade of yellow color RGB_Color(10, 0, 255) //Showing the shade of blue color ![]() RGB_Color(20, 255, 4) //Showing the shade of green color RGB_Color(255, 5, 5) //Showing the shade of RED color LedcSetup(BLUE_channel, PulseWM_Frequency, PulseWM_resolution) LedcSetup(GREEN_channel, PulseWM_Frequency, PulseWM_resolution) LedcSetup(RED_channel, PulseWM_Frequency, PulseWM_resolution) #define PulseWM_resolution 8 // 8 bit resolution #define PulseWM_Frequency 5000 // PulseWM frequency Step 6 − Upload the program to ESP32 by pressing the right arrow near the tick sign. Write the C program and compile it using the tick sign. Step 4 − Download Arduino IDE if it is not installed on the Computer and set it ups. Now connect the resistor pins to ESP32 pins (D21, D19, D18 ). Connect the longest leg of RGB LED to the blue rail directly and the other lines to resistors. Step 2 − Attach the breadboard negative rail to the ESP32’s GND. Step 1 − Connect the ESP32 microcontroller to the breadboard. Then write the C program using Arduino IDE. So, first, make the circuit as shown in fig 1. Arduino IDE is then needed to write the C program, compile it and then push it into ESP32 for its execution. Example 1: Using an RGB led with ESP32įirst the ciruit is made using breadboard, ESP32, one RGB LED, 3 resistors and some male-to-male wires. The first one is for red, the third one for green, and the fourth one for blue. It has 4 pins and the longest one (2nd in number) is –ve. RGB led is an LED that can show the mix of RGB colors and can produce shades. In example 2, the Wokwi simulator is used with Arduino microcontroller and an RGB led with red, green, and blue single colored leds. In example 1, the actual circuit using a breadboard, ESP32, RGB LED, resistors, and wires is made and the components are controlled using the C program made using the Arduino IDE. In this article, using two different examples, the way to use the RGB led is given. However, to get real results, using the circuit components and making the actual circuit is important. There are some simulators available to make the beginner of IOT learn such concepts without even having the IOT devices available. Then it is important to manage that circuit using a program. To learn about RGB led and the difference between single-color LEDs, it is important to make a circuit using a microcontroller such as ESP32 or Arduino and RGB led. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |