Hi Community!
In this projectwe will see the step by step of our code and its operation, we have to manage to turn on 3 leds of different colors, with a duration specific, and in turn turn them off in order with the same duration, this code will be achieved thanks to previous theoretical knowledge, where we touched on GPIO topics and using the platform PlatformIO.
Step 1
First we make the circuit for our project:
Step 2
First we will do the procedure of creating the new project by the platform PlatformIO. 3. After creating this project, we remember to put the speed of the card in the file configuration, which is about 115200.
Step 3
We start by creating the code, applying the necessary libraries so that our code can work:
Step 4
We define our input and output of the circuit, in the case of the input it would be the 3 LEDs of different colors:
Step 5
The function is created for the Inputs and Outputs to work:
Step 6
Then the I/O function we created before, in our code or function will be called main where the logic goes:
Step 7
Then the logic of our circuit will begin, in which it is necessary that the leds light up at different times, for the red LED it would be 500ms, for the green LED about 1000ms, and the blue LED would be 1500ms. After this it will turn off with the same length in the same order:
Step 9
Next, we will see test images where you can see that it was achieved successfully the experience: