[ Arduino Workshop : 2018/5 ] R Robotics Club

## Preface
Hello everyone, this is Norio from R robot club. I hope that you are exciting to be here today!
In this article, I would like to write about the introduction to Arduino.

## Agenda
1. Introduction ~ Setup the environment ~
2. Blink your LED!

## 1. Introduction ~ Setup the environment ~
[**Reference to Official Website**](https://www.arduino.cc/en/Guide/HomePage)
welcome on board of the journey with Arduino!
First of all, let's prepare the environment to play with Arduino.
The Arduino Software (IDE) allows you to write programs and upload them to your board. With regard to the installation of the IDE, actually you have two options below.

1. Code online on the Arduino Web Editor  
To use the online IDE simply follow [**these instructions**](https://create.arduino.cc/projecthub/Arduino_Genuino/getting-started-with-arduino-web-editor-on-various-platforms-4b3e4a). Remember that boards work out-of-the-box on the [**Web Editor**](https://auth.arduino.cc/login/?challenge=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJjcmVhdGUiLCJleHAiOjE1MjU5MTY1ODksImp0aSI6ImFiNDU3NDVjLTA4MDctNDNlMi1hY2NkLWE4YjdjZjQ3NGU5ZCIsInJlZGlyIjoiaHR0cHM6Ly9oeWRyYS5hcmR1aW5vLmNjL29hdXRoMi9hdXRoP2NsaWVudF9pZD1jcmVhdGVcdTAwMjZzdGF0ZT01ajJhbjF1ZVx1MDAyNnNjb3BlPXByb2ZpbGU6Y29yZSUyMHByb2ZpbGU6Y29udGFjdCUyMHByb2ZpbGU6cHVibGljJTIwY3JlYXRlOnVzZXJzJTIwY3JlYXRlOnNrZXRjaGVzJTIwY3JlYXRlOmxpYnJhcmllcyUyMGNyZWF0ZTpjb21waWxlJTIwaW90OmRldmljZXMlMjBwcm9maWxlOmFkZHJlc3MlMjBwcm9maWxlOnByaXZhdGVcdTAwMjZyZXNwb25zZV90eXBlPXRva2VuXHUwMDI2cmVkaXJlY3RfdXJpPWh0dHBzJTNBJTJGJTJGY3JlYXRlLmFyZHVpbm8uY2MlMkZsb2dpbi5odG1sIiwic2NwIjpbInByb2ZpbGU6Y29yZSIsInByb2ZpbGU6Y29udGFjdCIsInByb2ZpbGU6cHVibGljIiwiY3JlYXRlOnVzZXJzIiwiY3JlYXRlOnNrZXRjaGVzIiwiY3JlYXRlOmxpYnJhcmllcyIsImNyZWF0ZTpjb21waWxlIiwiaW90OmRldmljZXMiLCJwcm9maWxlOmFkZHJlc3MiLCJwcm9maWxlOnByaXZhdGUiXX0.RNjgvLvdnWDfLx-cGcKCSCeo2rh9pPWOLGT9RscPZ0-tHgGxNTpnUHNU-_tAzrabM_wHp_cGqPwchSWsNAg8ZLdExM8oAVvBLiMV2Z5Y0AjW3h6cKFXA_mzcQcWNdGCU7skv-zGUrXz5fsxopSipKs9E0EulidoJp9OHfvnCstjFngtIqEv9hf4kdR1l5gOY9p5TYLOJyDH3NkWpc8J6JE-K-d_PXpa-o75-7kB37PBlhXB5Xv0-KRtjID-_2ermTki7qoqhXBRryDKAoNZcO0U5Qa-KuTyeFMbLeaJh6F2UCT3NQGqx4_AqlCYGLRDvDRs7b7ecOYWIt6eHhpA5ErIrUt_Fuq4XbYuj4z32gFHrfphQ_f_NzxV-hWcgnrhnQdFIXiO6W9nVjOwTt2_jn7b9K_HtYu1JsD0GGtPl-jIEPfexKjTyJDrDdq94kW3pCv0Xv0OjEpTpRhV_OAaw6sUXy8VztJkD3UCsn2eeymO1VcD3pQo9pVyfUqqxt53ZHpt4bj3FM4etRlC-s9uaGSu_7RnZgNrjAAe0uYkHnumEV2YnGArH4fbx6ipNzihkcn4I4qmc4iZK2E2DJujyipZdukuo7kaq5awRhlIMorxwYSopEWUC8chULZoPnUmqBjTOAcw9nyoqKUx5H-pC8YOmvTsWsoPrQE5phN9U1i4), no need to install anything.
2. Install the Arduino Desktop IDE  
To get step-by-step instructions select one of the following link accordingly to your operating system.   
  [Windows](https://www.arduino.cc/en/Guide/Windows)  
  [Mac OS X](https://www.arduino.cc/en/Guide/MacOSX)  
  [Linux](https://www.arduino.cc/en/Guide/Linux)  
  [Portable IDE (Windows and Linux)](https://www.arduino.cc/en/Guide/PortableIDE)  
Choose your board in the list here on the right to learn how to get started with it and how to use it on the Desktop IDE.

Congrats!! Now, you have your weapon to control your Arduino!
** Further Interests on Arduino and its IDE, please refer to these links below.
[**What is Arduino??**](https://www.arduino.cc/en/Guide/Introduction)
[**Arduino Software**](https://www.arduino.cc/en/Guide/Environment)
[**Additional Libraries**](https://www.arduino.cc/en/Guide/Libraries)
[**Trouble shooting**](https://www.arduino.cc/en/Guide/Troubleshooting)

FYI, now I assume that you are ready for getting your hands dirty!!
So, lastly let's have a look of the faces of the real-world projects!
<img width="1184" alt="Screen Shot 2018-05-10 at 10.44.24.png" src="https://qiita-image-store.s3.amazonaws.com/0/240801/6e3da380-638e-cd44-f1a4-b5602526c4bc.png">
[Image reference](https://www.hackster.io/arduino/projects)

Looks brilliant, doesn't it? Now it's your turn!

## 2. Blink your LED!
Now, let's jump into the actual hands-on lecture!
Before building your own circuit, firstly let's take a look at the parts embedded with Arduino. We believe that understanding of its parts enhances your knowledge.

![arduino_3.jpg](https://qiita-image-store.s3.amazonaws.com/0/240801/69fd9ec3-f62a-dac4-19b1-cf02a1ee0c89.jpeg)

[Source of this image](http://full-parts.com/arduino-uno-r3.html)

** Advanced Reference of the architecture of Arduino
https://www.tutorialspoint.com/arduino/arduino_board_description.htm

### <font color='orange'>**Circuit Image**</font color>
<img width="243" alt="Screen Shot 2018-05-15 at 14.16.37.png" src="https://qiita-image-store.s3.amazonaws.com/0/240801/a0e949e9-ae30-c6b0-5a3a-705fd7fdd6e3.png">
[Source of this image](https://matome.naver.jp/odai/2142565287041479101)

### <font color='orange'>**Schematic**</font color>
<img width="254" alt="Screen Shot 2018-05-15 at 14.02.51.png" src="https://qiita-image-store.s3.amazonaws.com/0/240801/888899d1-7d31-3398-63b0-bc69630be74a.png">

### <font color='orange'>**Code**</font color>
After you build the circuit following above, let's write the actual code.
In fact, as you can see below, it just a C programming language. So if you are familiar with it already, please skip this part, otherwise, save a time and investigate the code carefully.

```c
// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}
```

### <font color='orange'>**Output**</font color>
![arduino-led1.gif](https://qiita-image-store.s3.amazonaws.com/0/240801/c892384a-f0b4-211c-1805-3e7e86f0d7a4.gif)
[Source of this image](http://kojmart.com/javascript-arduino-led-3231)

Congratulations on your first Arduino application, for you maybe it looks quite easy though, this is "Hello World" in Arduino!

## Conclusion
In this tutorial, through a "Hello World" project, we have equipped ourselves with the foundation of Arduino and have seen a procedure of Arduino development.
With regard to further development of Arduino, I would like to interact with many sensors which we bought beforehand. From now, I would like you to refer to this  good guide in Arduino web-site.

*LINK: https://www.arduino.cc/en/Tutorial/BuiltInExamples*

The Sensors
<img width="664" alt="Screen Shot 2018-05-15 at 14.22.11.png" src="https://qiita-image-store.s3.amazonaws.com/0/240801/b4b2c474-46c3-f547-07ce-382607889eba.png">
Link: https://www.amazon.com/kuman-Arduino-Raspberry-Projects-Tutorials/dp/B016D5L5KE