One big thing that you may not be used to is that CaPiTal lEttErs maTter! Things change color as you type them correctly. The words like OUTPUT, HIGH, and LOW will not change colors if you type them wrong.
Another thing that you may not have seen before is an under-script, it looks like this _. To type _ you have to hold shift and - at the same time. The minus is beside the 0 (zero). |
If you got an error message, check the following things.
1) Are all the colored parts in this picture here colored in your code? 2) Check CaPiTaL letters. (they matter) 3) Have you forgotten a ; 4) You may have forgotten a ( or ) 5) Did you type the curly brackets, { } If you get no error (bottom box is not orange), then you can move on. Still having issues? Let your teacher know! |
The // double dashes are just comments. You do not need to type them. The Arduino does not do anything with them. They they help people know what each line of code is supposed to do.
Remember, this video shows what the Arduino should be doing. |
|
It is important to know LEDs only let current flow through it one way.
If your light does not turn on, try flipping how your LED is connected. It may just be in backwards. |
The LEDs only work when the longer end connects to positive pins on the board. The + pins on the board are any of the numbered pins, the 3V, or the 5V.
|
<--Use this button to learn how |
LEDs are Light Emitting Diodes. Light Emitting means they make light. A diode is something that only lets electric current go one way. That means direction matters! The longer LED wire is the + side, and the shorter LED wire is the - side.
Tip: use black wires to connect - parts (aka GND) and red wires to connect + parts (aka 3.3 or 5V lines) See how that is done in the pictures above? |
Here is the example multi-blink code from earlier. See how we have to keep typing LED_BUILTIN over and over? We can avoid that by making what is called a "variable". Variables are easily able to be adapted/changed. If you have taken algebra, think solving for x, where x is the variable!
What if we wanted to change which light to turn on? We would then have to then retype all of the LED_BUILTIN parts, gross! If we make a variable for the light at the start of our code? Then we will only have to change the pin we want to light up in just one spot! |
See this small change we added to the beginning of our code, line 1?
This is the variable we are defining. Const means constant. That means we are telling the computer that this variable will not be changing when the code runs. int means integer. An integer means whole numbers. Integers are numbers like 1, 5, 22, etc. LED_BUILTIN is actually connected to Arduino pin 13, so we could have just typed in 13 there if we wanted. |