Browse Source

Articles-and-Papers

master
test2 5 years ago
parent
commit
ef70948c31
  1. BIN
      1fbbfedb89a5133d.png
  2. BIN
      6061b4c693302b28.png
  3. 96
      Intro-Arduino.adoc

BIN
1fbbfedb89a5133d.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
6061b4c693302b28.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

96
Intro-Arduino.adoc

@ -42,9 +42,98 @@ Arduino Uno has a couple of other pins as explained below:
- AREF: Used to provide reference voltage for analog inputs with analogReference() function. - AREF: Used to provide reference voltage for analog inputs with analogReference() function.
- Reset Pin: Making this pin LOW, resets the microcontroller. - Reset Pin: Making this pin LOW, resets the microcontroller.
== Communication == Install the Arduino Software (IDE) on Linux
=== Download the Arduino Software (IDE)
==== Installing via a tarball
Get the latest version from the download page. You can choose between the 32, 64 and ARM versions. +
It is very important that you choose the right version for your Linux distro.
Clicking on the chosen version brings you to the donation page and then you can either open or save the file. Please save it on your computer.
TIP: We can download the latest version of the Arduino IDE from the Arduino website (here) as a tarball. A tarball is a type of compressed folder, like a .zip file, commonly used to distrubute software in Linux; its file extension is usually .tar.xz (or .tar.gz, if it uses Z compression. We'll get to this later).
WARNING: Installing via apt
While there is a package for the Arduino IDE on current APT repositories, it has not been updated for a while.
As such, while it is still possible to install the IDE by running sudo apt install arduino, it is not recommended to do so, as asking for support when using outdated software is more difficult.
In order to extract the files we need from the tarball, we can open a terminal, cd to where the downloaded tarball is, then run
```
tar -xvf FILENAME
```
where FILENAME is the name of the download (typically arduino-(version number)-linux64.tar.xz).
The command can be read as
* e**X**tract from an archive...
* **V**erbosely (meaning it prints the name of every file it finds)...
* from a **f**ile given by FILENAME.
When the command finishes, run ls again; tar should have created a new folder named arduino-(version number).
cd into the folder; there will be a file named install.sh in the folder. To install the IDE, execute install.sh with
```
./install.sh
```
If the script executes correctly and outputs done! at the end of its output, the IDE was installed correctly! Let's try to launch it in the next step.
=== First Launch
Before launching the IDE, connect your Arduino board to your computer with a USB cable.
==== Permissions checker
The first time we launch Arduino, a window will pop up asking to add us to the dialout group:
image:./1fbbfedb89a5133d.png[alt="IDE.",width=250,height=250]
==== Permissions
We can look at the Arduino device by running
```
ls -l /dev/ttyACM*
```
in a terminal. The output looks mostly like this:
```
crw-rw---- 1 root dialout 166, 0 Des 14 09:47 /dev/ttyACM0
```
The ‘0' at the end of ‘ACM' might be different, and multiple entries might be listed, but the parts we need to focus on are the string of letters and dashes in front, and the two names root and dialout.
The first name root is the owner of the device, and dialout is the owner group of the device.
The letters and dashes in front, starting after ‘c', represent the permissions for the device by user:
* The first triplet rw- mean that the owner (root) can read and write to this device
* The second triplet rw- mean that members of the owner group (dialout) can read and write to this device
* The third triplet --- means that other users have no permissions at all (meaning that nobody else can read and write to the device)
In short, nobody except root and members of dialout can do anything with the Arduino; since we aren't running the IDE as root or as a member of dialout, the IDE can't access the Arduino due to insufficient permissions.
After you log back in the Arduino IDE, the Serial Port option should be available; change that, and we should be able to upload code to the Arduino.
image:./6061b4c693302b28.png[alt="Port.",width=250,height=250]
==== Coding
Congratulations, you made it!
You've just installed the Arduino IDE on your computer; you've also learned how permissions and groups work in Linux!
Arduino can be used to communicate with a computer, another Arduino board or other microcontrollers. The ATmega328P microcontroller provides UART TTL (5V) serial communication which can be done using digital pin 0 (Rx) and digital pin 1 (Tx). An ATmega16U2 on the board channels this serial communication over USB and appears as a virtual com port to software on the computer. The ATmega16U2 firmware uses the standard USB COM drivers, and no external driver is needed. However, on Windows, a .inf file is required. The Arduino software includes a serial monitor which allows simple textual data to be sent to and from the Arduino board. There are two RX and TX LEDs on the arduino board which will flash when data is being transmitted via the USB-to-serial chip and USB connection to the computer (not for serial communication on pins 0 and 1). A SoftwareSerial library allows for serial communication on any of the Uno's digital pins. The ATmega328P also supports I2C (TWI) and SPI communication. The Arduino software includes a Wire library to simplify use of the I2C bus.
== Programming Arduino == Programming Arduino
@ -92,8 +181,7 @@ void loop() {
== Arduino == Arduino
+ image:./Arduino_KY-012_Keyes_Active_buzzer_module_connection_diagram.png[alt="Arduino.",width=250,height=250]
image:./Arduino_KY-012_Keyes_Active_buzzer_module_connection_diagram.png[alt="Arduino.",width=150,height=150]
:hardbreaks: :hardbreaks:

Loading…
Cancel
Save