Small knowledge, big challenge! This article is part of the “Programmer’s Essentials

This article also participated in the “Digitalstar Project” to win a creative gift package and creative incentive money

Recently, I had the opportunity to get in touch with the development of the Internet of Things, so learn about it and write it down.

After looking up various materials, comparing various difficulties, the richness of materials and cases, I picked a soft persimmon and finally chose Arduino. Due to my limited experience, I only saw online that this board was easy, so I chose it. Another reason is that this board seems to be relatively cheap, so I play it.

1, the Arduino

Official website: www.arduino.cc/

Arduino development board is based on the design concept of making it easy for users to use and open source. It has the advantages of flexibility and convenience, low threshold to get started, rich interfaces, multi-functions and easy expansion, so it is widely used in the field of electronic design. At present, there are many kinds of Arduino development boards on the market, such as Arduino UNO/UNO R3, Arduino101/Intel Curie, Arduino Micro, Arduino Ethernet, Intel Galileo development board and so on. This kind of development board is very quick to start, simple to operate, and relatively cheap, only more than ten yuan.

Unique Advantages:

(1) Openness: Arduino is an early open source hardware project, and its hardware circuit and software development environment are completely open.

(2) Ease of use: Easy to use, no need to install additional drivers, using C-like language, the main function only involves setup and loop connected modules.

(3) Easy communication: Arduino has delineated a relatively unified framework, and some low-level initializations have adopted a unified method. Ports used by digital signals and analog signals have also been calibrated by themselves, which makes it very convenient for beginners to use AC circuits or programs.

2. Environment construction

Want to play development board have to write code, otherwise the Arduino don’t know how to run, the Arduino development language is C, also good university learned that after work while using less, but programming languages are only different syntax, programming experience is universal, so programming is good fit for me, want to have to make a programming environment programming, The IDE, that is, starts to work.

2.1 Downloading Software:

Official download address:

www.arduino.cc/en/software

The following figure is shown when you open the web page. There are two official programming methods, one is code online, and the other is downloading software for local programming. In order to experience programming, download software decisively.

Official ides support different operating systems, depending on your platform, in this case Windows

Click on the red box in the image above to see the following interface.

I can choose to donate or JUST DOWNLOAD the software. As a poor person, I resolutely choose JUST DOWNLOAD. The software has 113M, and I can wait for the DOWNLOAD according to my own network environment.

2.2 ide installation

Double-click the downloaded EXE file, the following screen appears.

You have no choice. Go to I Agree😜 on the right

Bring sparks all the way to Next until installation is complete

During the installation process, the following pop-up window may pop up. This is the installation driver. For us, in order to avoid unnecessary trouble, we can directly select the installation

2.3 Software Trial

Double-click the icon on the desktop to open the software, you can see the following interface

The UI of Arduino IDE is in line with my aesthetic appreciation. The interface is simple, the font is comfortable, and several commonly used buttons are placed in the toolbar.

2.5 Code Interpretation

When you open the IDE interface, the default is the following code, which looks a bit familiar, a bit like the Unity script, minus some functions.

void setup(a) {
  // put your setup code here, to run once:
​
}
​
void loop(a) {
  // put your main code here, to run repeatedly:
​
}
Copy the code

Setup is code that runs at device initialization, initializes environment variables, loads necessary configuration, and so on

A loop is an infinite loop that keeps running after the device starts. It is the Update function in Unity scripts, but the loop has no pause time and is where the business logic is executed.

The loop is repeated, but the data is different, and the world is so big that it’s up to you to play with it.

3, summarize

The Arduino environment is really simple. Seeing this simple IDE, I actually feel THAT I can do it, but my reason tells me that I can’t. Haha, Arduino hasn’t bought one yet, so let’s go buy one and make our own Hello world.