![]() The code to control an RGB LED is very straightforward. Important: if you’re using an RGB LED common cathode, you need to comment and uncomment some code in the loop() How the Code Works Reads the current position of the potentiometer and converts Int potBlue = A2 // Potentiometer controls Blue pin -> A2 Int potGreen = A1 // Potentiometer controls Green pin -> A1 Int potRed = A0 // Potentiometer controls Red pin -> A0 Upload the following sketch to your Arduino board: /* Important: if you’re using an common cathode RGB LED, you need to connect the longer lead to GND instead of 5V. You can use the preceding links or go directly to /tools to find all the parts for your projects at the best price!įollow the next schematic diagram to wire the circuit:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |