I'll give it a shot
Hopefully it won't be a complete formatting mess.
Strictly speaking, what you need to get started with an Arduino is the Arduino itself, a USB cable and install the free software on your pc. I recommend getting a genuine Arduino UNO / Genuino UNO to start with, as the cheap ebay ones have a higher dead on arrival rate, and it will help support the development of the software and hardware financially. When you've got the basics down, buy a drawer full of small Arduino nanos from China like me.
If you're using windows 10 you can go to the windows store app and search for "Arduino IDE"
https://www.microsoft.com/store/productId/9NBLGGH4RSD8 . Installing from the store will keep the app updated. Other install instructions can be found here:
https://www.arduino.cc/en/Guide/HomePage .
Here are instructions for uploading the first sketch to an Arduino UNO:
https://www.arduino.cc/en/Guide/ArduinoUno
And here are instructions for uploading the first sketch to an Arduino Nano:
https://www.arduino.cc/en/Guide/ArduinoNano . If you bought cheap off brand nanos, you may have to select Atmega328p (Old bootloader) in the processor menu to get it to upload and you may have to install some drivers for the USB chip.
After getting the first blink example to work, look through the other examples and keep
https://www.arduino.cc/reference/en/ close by. That will be your favorite site for a while.
***
For the people towards the front of the class:
If you have any experience with C or C++, you may notice that you feel right at home. The basic Arduino is an Atmega 328p microcontroller and a USB-serial converter on a pcb. If you want to use AVR C examples from Atmega or school, with int main() instead of setup() and loop() or PIND instead of digitalRead(), those can usually be pasted right into the Arduino environment. Arduino just adds some premade functions and clock setups behind the scenes to simplify the coding.
***
There are many getting started kits out there, but I would recommend getting the following as a minimum, in a prioritised list (The links to banggood.com are only meant as examples):
- Breadboard, just push the components in and make your circuit.
https://www.banggood.com/Prototype-B...-p-948106.html
- Dupont jumper wires, can be used with breadboard and arduino or you can even plug LEDs straight into them. Get all three types, female-female, male-male, male-female.
https://www.banggood.com/120pcs-20cm...-p-974006.html
- An assortment of resistors. The blue 1/4 watt 1% is very cheap, but the leads are a bit thin.
https://www.banggood.com/Wholesale-6...e-p-53320.html
- LEDs. Standard 5mm of any color will do.
https://www.banggood.com/375pcs-3MM-...p-1027601.html
- Pushbuttons. Often called "PCB tactile push button". Make sure they have legs.
https://www.banggood.com/100pcs-Mini...-p-917570.html
- Digital multimeter. Being able to measure voltage and resistance will help you a lot. You probably don't need to go expensive for 5 volt electronics.
- 22-24 AWG solid core wire to make your own smaller jumper wires for the breadboard
- Wire strippers
- Wire cutters
Some programming tips:
Looking at
https://www.arduino.cc/reference/en/ you may feel a bit overwhelmed. Remember that all those functions are there to help you! You don't need to learn all of them. Here are some info on the basics:
The first thing that confused me was whitespace. Whitespace like spaces and indents and linebreaks doesn't matter, they're just there to make it look prettier. The only time a line break matters is to end a //comment.
FALSE and LOW is the same as 0. TRUE and HIGH is the same as anything else. This works for both tests and I/O functions.
A variable is a box to store numbers in. You can make them the size you want and call them (almost) whatever you like.
Byte is a 1 byte variable, storing a value up to 255 when you want to save memory. Int will be your standard workhorse, 2 bytes stores up to 32768. Long stores 4 bytes for a value of 2 billion.
Variable1 = 23; saves the value 23 in the variable Variable1.
Variable1 = Variable1 - 3; Makes the saved value 20.
There are two basic control statements: if…else and while. Switch…case is series of if…else statements and for can be done with a while loop.
If ( thing1 > thing2 )
{
thing3 = 76;
}
If the test condition inside the parenthesis is true or is more than 0, the instructions inside the curly brackets are performed. The test conditions can be math, a single variable or a test like <, >, == (is equal to), != (not equal to), >= (larger or equal) and <= (smaller or equal) with multiple variables or values.
Else if( thing1 == thing2 )
{
thing3 = 77;
}
Else
{
thing3 = 78;
}
Else if and else are optional and will immediately follow the if statement. Else will do its thing if the other test conditions are false or 0.
While( thing1 > thing2 )
{
Helpimstuckinaloop = 1;
}
While will loop inside the curly brackets as long as the test condition is true or more than 0.
counter = 10;
While ( counter > 0 )
{
delay(1000);
counter = counter - 1;
}
This is a more useful while loop that can be replaced with a "for" statement. This example will delay for 10 x 1000 milliseconds.
Sometimes you'll see these control statements without curly brackets. The curly brackets are optional if there is only one single instruction in the branch, but skipping them can cause human confusion.
Digital in and out:
The I/O pins can be internally switched to 0v (LOW) or 5v (HIGH). They can also be disconnected or floating. The behaviour is switched with pinMode() and digitalWrite(). digitalRead() can read the state of the pin.
pinMode(pin number, mode);
All pins default to INPUT and LOW if not changed.
- Forgetting to set pin mode to OUTPUT is a common error if an LED is less bright than expected.
mode
OUTPUT:
Use a series resistor for all connections when setting pin mode to OUTPUT.
digitalWrite(pin number, LOW):
The pin is connected internally to 0v.
digitalWrite(pin number, HIGH);
The pin is connected internally to 5v.
Do not connect to anything higher than 5v.
Do not connect directly to ground.
mode
INPUT:
digitalWrite(pin number, LOW):
The pin is in high-impedance mode and will not affect the external circuit it's connected to. The external circuit will see it as if it was disconnected.
Usually used with an external pull up or pull down resistor when using digitalRead() or the state may float and be undefined.
digitalWrite(pin number, HIGH);
The pin is connected internally to 5v through a pull up resistor.
Allows connecting a switch between pin and ground without an extra pull up resistor, but be careful to not accidentally switch pin mode to OUTPUT or the 5v rail could be shorted to ground, destroying the pin.
* mode
INPUT_PULLUP:
INPUT_PULLUP is a shortcut for setting pin mode INPUT and digitalWrite HIGH.