The following materials were procured for this project:
- Arduino UNO Rev3 board: Link to Product
- USB-A to USB-B cable: Link to Product
- LED bulbs: Link to Product
- RGB LED bulb: Link to Product
- Resistors in the following varieties:
- 220 OHM
- 1,000 OHM
- 10,0000 OHM
- 100,000 OHM
- Breadboard jumper wires: Link to Product
- Mini Breadboard: Link to Product
- 3 position dip switch: Link to Product
- OLED display: Link to Product
- Passive buzzer: Link to Product
- Customizable 4x4 keypad: Link to Product
- Rotary Encoder: Link to Product
- 7 segment LED display: Link to Product
- VS Code needs to be installed on your system.
- VS Code requires that the standard Arduino IDE is installed, as it uses some of the libraries included in the IDE.
- Arduino code is built on C++, and you will need to install the C/C++ compliler VS code extension to complile your sketches.
- Install the Arduino Extension for VS Code.
- Depending on your system, istallation options vary. Follow the Link to Arduino CLI installation to complete the necessary steps for your system.
arduino-cli
has many commands, each of which has its own dedicated help text. These can be shown with thehelp
command like this:
arduino-cli help core
- run the following command:
arduino-cli config init
- inspect the contents of
arduino-cli-yaml
to see the available configuration options with their default values. For more information on the config file, see the configuration documentation
- arduino programs are run in files called sketches.
- To create a new sketch named
MyFirstSketch
in the current directory, run the following command:arduino-cli sketch new MyFirstSketch
- sketch files end in
.ino
, so in this case our sketch file is calledMyFirstSketch.ino
- the boilerplate code for a sketch will look like this:
void setup(){
}
void loop() {
}
- the setup function is where you declare what your input and ouputs will be, or if you are utilizing the internal LED on the arduino board.
- the loop function is where you write the code to be executed on a loop, normally with
delay
timeouts. Various methods and approaches to this will be gone into in the.md
files for individual sketches.
- first, update the local cache of available platforms and libraries by running the following command:
arduino-cli core update-index
- After connecting your board to your PC using the USB-A to USB-B cable, check whether the board is recognized by running the following command:
arduino-cli board list
. The output should be something along the following lines:
$ arduino-cli board list
Port Type Board Name FQBN Core
/dev/ttyACM1 Serial Port (USB) Arduino/Genuino MKR1000 arduino:samd:mkr1000 arduino:samd
- If you see an
Unknown
board listed, you will need to identify the platform core and correct FQBN string. - List all the supported boards and their FQBN strings with the following command:
arduino-cli board listall mkr
- to install the
arduino:samd
platform core, run the following command:arduino-cli core install arduino:samd
- verify that the installation was a success with the following command:
arduino-cli core list
. The output should be something similar to the following:
$ arduino-cli core list
ID Installed Latest Name
arduino:samd 1.6.19 1.6.19 Arduino SAMD Boards (32-bits ARM Cortex-M0+)
- to compile the sketch, run the
compile
command, passing the proper FQBN string.arduino-cli compile --fqbn arduino:samd:mkr1000 MyFirstSketch
- if the sketch does not compile correctly, errors can be viewed in the terminal.
- to upload the sketch, run the following command, using the serial port your board is connected to:
arduino-cli upload -p /dev/ttyACMO --fqbn arduino:samd:mkr1000 MyFirstSketch
. If all works according to plan, this should execute code is contained within the loop function of your sketch file.
NOTE: For a more user friendly experience, you can work in the Arduino IDE directly, where there is UI for compiling and uploading sketches. Unfortunately, VS code does not integrate with the IDE and CLI is necessary on this platform.
Link the Arduino IDE
- Electricity Basics playlist on Youtube from The Engineering Mindset.