The function then calls 'analogWrite' to set the brightness of each LED. In each case the number will be in the range 0 to 255, where 0 means off and 255 means maximum brightness. This function takes three arguments, one for the brightness of the red, green and blue LEDs. void setup()īefore we take a look at the 'loop' function, lets look at the last function in the sketch. In this case, all it has to do is define the three pins we are using as being outputs. ![]() Setup function runs just once after the Arduino has reset. As we have learnt in earlier lessons, the The next step is to write the 'setup' function. The sketch starts by specifying which pins are going to be used for each of the colors: Try the sketch out and then we will dissect it in some detail. The last FOR loop will go from BLUE to RED. The second FOR loop will go from GREEN to BLUE. The first FOR loop will go from RED to GREEN. Our code will use FOR loops to cycle through the colors. I read the "how to" sections here, but not sure I'm completely understanding all of it. Thank you for any help! And I apologize if I posted this incorrectly. I'll copy and paste it here and hope that someone will be kind enough to actually write it out for me, so that I can see what is missing. They do give some info in the documentation. I have everything wired up correctly, I just need the sample program so that I can tinker with it. So, I have gone through the documentation that came with this kit and am now on Lesson 4, trying to figure out the software to blink and RGB LED different colors. I learn best by taking examples and taking them apart and reverse engineering them, to figure out what does what. And from what I can tell, it is very poorly written for someone with zero previous experience. The ONLY experience I have with this is the documentation which came with the kit. But I'm apparently very deficient on the programming side. I'm okay from the electrical side of it, as in I can reference everything and figure out how it works. Now that I'm a lot older, I saw this Elegoo kit on Amazon and bought it, hoping I could teach myself about Arduino. ![]() ![]() Back when I was a kid, I had one of the fancy Radio Shack 60-in-1 electronics kits.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |