![]() ![]() To pause the program we’ll use delay(), which takes a number of milliseconds (1000ms = 1s).In order to connect up a 12v LED strip to an Arduino, you will need a few components: The output command we’re using is called digitalWrite(), which is a function that sets a pin HIGH or LOW, on or off. The colored text following double slashes are also comments to help make the program easier to understand. This part of the code will execute on repeat, so long as the board has power. It runs once when the program starts up, and contains everything within its curly braces. Next is the code’s setup, which helps set up things your program will need later. Block comments are bookended by an opening /* and closing */. ![]() This first section is title block comment, describing what the program does. This program blinks pin 13 of the Arduino (the We'll go through each piece here, and you can always use the blocks for comparison as you level up throughout the lessons on this site. All the extra symbols are part of Arduino’s syntax, but don’t be intimidated! It takes time to learn to write proper code from scratch. When the code editor is open, you can click the dropdown menu on the left and select "Blocks + Text" to reveal the Arduino code generated by the code blocks. It even has its own tiny resistor, soldered directly to the surface of the board. HINT: Did you notice the small LED flashing on the board itself? This built in LED is also connected to pin 13, and is meant to be used for testing purposes without the need to connect any external components. You can even add more output and wait blocks to create longer flashing patterns.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |