Arduinoyun tutorial on the Arduino programming environment setup

Source: Internet
Author: User

Arduinoyun Tutorial of Arduino programming environment to build Arduino programming environment

In general, what we call Arduino is a development board that we can actually see, which can be Arduino UNO, Arduino Yun, Arduino Mega, and so on. But in a strict sense, the name Arduino not only represents the development Board, but also involves hardware, software, development team, design principles and the spirit of mutual assistance of the user community. This is the difference between Arduino and other development boards. In this chapter, we will focus on how to build the Arduino programming environment on Windows and Linux operating systems.

Arduino IDE

The IDE is an acronym for the Integrated Development environment (integrated development environment). Arduino officially provides the Arduino IDE, which integrates the editor, compiler, and downloader. Like the Arduino Development Board, the Arduino IDE is developing source code. Due to its openness, it can be installed in the three major systems of Windows, MAC OS x and Linux.

Installing the Arduino IDE in the Windows operating system

Similar to installing the Arduino IDE in Linux, there are two ways to install the Arduino IDE in Windows. One is a common form of Windows Setup Wizard, and the other is a green package (Arduino official parlance is a non-system administrator installation method). The Windows version of the Arduino IDE can be downloaded from HTTP://ARDUINO.CC/EN/MAIN/SOFTWARE#TOC3.

1.Windows Installation Wizard Form

The Installation Wizard way of Arduino is similar to the common Windows class Software installation method, which completes the installation by asking you a series of questions. The installation version file name for the Arduino IDE is Arduino-1.5.7-windows.exe.

(1 Double-click to run it, first the 2.1 shown in the Protocol Information dialog box, as shown in 2.1.

(2 After reading the agreement, click the I agree button to continue, this step is to select the installation option, you need to select the installed components, shown in 2.2.

Figure 2.1 Protocol infographic 2.2 installation options

    • The Install Arduino software option is mandatory, which is the main body of the Arduino IDE;
    • The Install USB driver option is the driver for installing the Arduino Development Board, most of which need to be checked;
    • The Create Starmenu shortcut option is to create a shortcut in the Start menu, which is selected according to your preferences;
    • The Create desktop shortcut option is a shortcut to the desktop, which is usually checked for easy access to the Arduino IDE;

The Associate. ino file option is used to associate files with the. Ino suffix with the Arduino IDE, and then double-click the. ino file to open in the Arduino IDE, which is usually checked for convenience.

(3 Clicking the Next button will ask you where the Arduino IDE is installed, as shown in 2.3.

In the popularity of 2T hard disk today, do not 10 years ago, "software does not install C-disk" thought passed down, so recommend the reader to use the default installation directory.

(4 Click the Install button to start the installation, and the Blue progress bar is used to indicate the installation progress, as shown in 2.4.

Figure 2.3 Selecting the installation path Figure 2.4 starting the installation

(5 when installed to about 99%, the prompt to install the driver will pop up, as shown in 2.5.

(6 Click the Install button to complete the installation of the Arduino USB drive. At this point, the Arduino IDE is also installed, and the completed prompt appears, as shown in 2.6.

Figure 2.5 Installing the Arduino USB Drive Figure 2.6 installation Complete

(7 Click the Close button to exit the Setup program. At this point, the Arduino IDE is installed in your window system, and the desktop appears with the Arduino IDE shortcut, 2.7.

Figure 2.7 Arduino IDE Shortcuts

2. Compression Package Form

The installation of a compressed package is even faster than the installation of Windows Wizard mode. The file name of the compressed package is arduino-1.5.7-windows.zip, you just need to extract it to the desired directory. To launch the Arduino IDE, just double-click the Arduino.exe file in the execution directory. If you want to quickly launch the Arduino IDE later, you can create a Arduino.exe shortcut on your desktop. Right-click the Arduino.exe file and select "Send To" | Desktop Shortcuts command.

Installing the Arduino IDE in the Linux operating system

Since the PC that I am using installs the openSUSE Linux distribution, the installation of the Arduino IDE on the Linux operating system is described here based on openSUSE Linux. For the early Arduino Development Board, it was easy to install the corresponding Arduino IDE on openSUSE, just search the Arduino IDE directly in software.opensuse.org and then 1 Click Install (one-click installation), as shown in 2.8.

Figure 2.8 1 Click Install Arduino IDE

However, since the Arduino Yun is a relatively new board, the stable version of the Arduino 1.0.5 has not increased its support (starting with the 1.5.4 release). Therefore, we can only install the latest Arduino 1.5.7 beta version manually at this point.

1. Installing the Arduino IDE dependencies

The Linux dependency problem can be a headache for many users, but the Arduino IDE now relies on only one package for the JDK. This is installed automatically when the openSUSE system is installed. If it is not installed on your system, you can search through the software Manager to install OPENJDK or perform the following command installation:

    • sudo zypper in JAVA-1_7_0-OPENJDK

2. Installation Arduino IDE

After the Arduino IDE 1.0.1 release, the compilation tools are integrated in the compact package. Therefore, only need to download the corresponding system version of the IDE, the download link is: Arduino.cc/en/main/software. The downloaded compression package is named Arduino-1.5.7-linux64.tar. Where 1.5.7 represents the version number of the IDE, Linux represents the operating system, and 64 represents the operating system version. To view the operating system version, use the following command:

    • Uname-m

If the output is x86_64, download the 64-bit version, otherwise download the 32-bit version.

Then unzip the downloaded package to your desired location. The tar package can be extracted using the following command:

    • TAR-XF Arduino-1.5.7-linux64.tar

The above command will extract the file to the current directory, and if you want to extract it to a different directory, you can use the following command:

    • TAR-XF arduino-1.5.7-linux64.tar-c/other/path

Among them,/other/path is the directory you expect.

3. Set permissions for users

Linux Strict Rights Management provides security for the system, each user has the right to be very precise and rigorous. Therefore, we need to add the current user to some special groups to get the required permissions. By default, the non-root user of openSUSE does not have access to the serial device, so the user needs to be joined to the Dialot group. In addition, the Arduino IDE requires permission to operate on the lock file, so you need to join the lock group. You can easily join a user to a specified group by using the following command:

    • Usermod-a-G group-name username

For example, you can use the following command to add a user Tom to the Dialot and lock groups:

    • sudo username-a-G dialot lock Tom

4. Running Arduino IDE

After doing all of the above, the Arduino IDE that supports the Arduino Yun is installed. To run the Arduino IDE, simply navigate the terminal to the Arduino uncompressed directory and execute the Arduino file that executes it, as in the following command:

    • ./arduino

At this point, the interface of the Arduino IDE opens, and the terminal no longer responds to other commands. If you want the Arduino IDE to not affect the terminal in response to other commands, you can use the following:

    • ./arduino &

The above command will run the Arduino IDE as a daemon.

Installing the Arduino IDE in other Linux distributions

Other more commonly used Linux distributions such as ArchLinux, Debian, Fedora, Gentoo, Slackware and other corresponding installation methods can refer to the link: playground.arduino.cc/learning/linux. The methods that are common to all Linux distributions can be found in the 2.1.2.

Arduinoyun and Fritzing

Fritzing is an open source hardware project. It provides users with an electronic device that is easier to understand than ordinary circuit design software as a raw material for production, making it easy for anyone to design their own circuitry. If you often mingle with the various Arduino communities, then be sure to be impressed with the circuit diagram shown in 2.9, which is made using fritzing.

Figure 2.9 Fritzing-made circuit

Since fritzing is an open source, free software, it supports three major operating systems. The following explains the installation of Fritzing in Linux and the Windows operating system. The Fritzing software package is: http://fritzing.org/download/.

2.2.1 Installing fritzing in the Windows operating system

Fritzing only provides a compressed package for the Windows operating system. So the reader only needs to download the corresponding version of Windows (named Fritzing.0.9.0b.64.pc.zip), then unzip it to the desired location and execute the Fritzing.exe. If you want to run fritzing more easily, you can send a shortcut to the desktop.

Arduinoyun installing fritzing in Linux operating system

This is also explained by openSUSE Linux as a basis. In fact, many of the distribution of the software warehouse has been included in the fritzing. In openSUSE, one-click installation can be done by searching for fritzing in software.opensuse.org. The latest version of Fritzing is 0.9.0b, and the official release in openSUSE's software warehouse is 0.8.3b, and the latest version requires an unofficial packaged version, shown in 2.10.

Arduinoyun official and unofficial version

These two versions can meet our needs, so readers can install according to their preferences, the author chose to install the official release of the 0.8.3b version. Of course, the reader can also download the compressed package to install it yourself.

(1 Download the corresponding version according to your own system. For example, the author uses a 64-bit computer, so the downloaded compressed package is fritzing-0.9.0b.linux.amd64.tar_1.bz2.

(2 Extract the BZ2 package using the following command:

    • TAR-XJF fritzing-0.9.0b.linux.amd64.tar_1.bz2

Of course, you can also use the-C parameter to unzip it to the desired location.

(3 similar to installing the Arduino IDE manually, you just need to go to the fritzing directory and execute the fritzing file.

Connecting the Arduino IDE and the Arduino Yun

The previous content prepares us for the future development of the Arduino Yun software section. Now it's time to connect the Arduino IDE with the Arduino Yun.

(1 Open the Arduino IDE and connect the Arduino Yun to your PC. We know that Arduino has many development boards like Arduino UNO, Mega, and so on. These boards are featured, and the Arduino IDE has only one, so you need to tell which board on which port you want the Arduino IDE to connect to.

(2 Select the Arduino Yun option in the "board" in the "Tools" menu item in the Arduino IDE, as shown in 2.11.

Figure 2.12 Selecting in the board type Arduino Yun

(3 We can choose the Arduino Development Board that is connected to the computer. Select by selecting the Arduino Yun command in ports in the Tools menu item in the Arduino IDE, as shown in 2.13.

figure 2.13 Selecting in Ports Arduino Yun

It is important to note that the Arduino IDE discovers multiple COM ports, and the number and number found in different environments vary. However, it is still easy to choose the Arduino Yun correctly, and the properly recognized Arduino Yun will appear after the corresponding COM name, figure 2.13 shows that the Arduino Yun is connected to the COM5 port of the computer.

Now, it's a step away from proving that our hardware and software are working properly. The method of testing is to complete the Hello World of the Arduino community. This method is very easy for us now and it can be done with just a few clicks of the mouse.

(1 ) to load the Blink source code by clicking File | Example "| basics| The blink command, shown in 2.14.

Figure 2.14 Loading the blink source file

(2 The new source file opens in a new window, and the next step is to upload the source file to the Arduino Yun after compiling it on your computer. The compile and upload actions can be done by the Run button in the Arduino IDE, or by the shortcut key Ctrl+u. After the upload is complete, the bottom of the Arduino IDE displays the operation information, as shown in 2.15.

Figure 2.15 The Arduino IDE's operation process

The information is broadly as follows:

    • Build options changed, rebuilding all
    • Sketch uses 4,754 bytes (16%) of program storage space. Maximum is 28,672 bytes.
    • Global variables Use 157 bytes (6) of the dynamic memory, leaving 2,403 bytes for local variables. Maximum is 2,560 bytes.

This information indicates that the compiler is going to recompile the program, the program space is 28,672 byte, the 4,754 byte (16%) is used, the dynamic memory is 2560 byte, the global variable uses 157 byte (6%), and the remaining 2,403 byte. Typically, this information can be safely ignored. And the special case is the program compiles the error situation, below is the compile error time information:

    • Blink.ino:In function ' void loop () ':
    • Blink.ino:25:26:error:expected primary-expression before '; ' token
    • Blink.ino:25:26:error:expected ': ' Before '; ' token
    • Blink.ino:25:26:error:expected primary-expression before '; ' token

The error is shown here in the source code, where 25 represents the row, and 26 represents the column (the actual reason is that I added a "?" in this location of the code.) characters).

This is followed by an introduction to the effect of the blink program correctly uploaded to the Arduino Yun. The normal situation is that the LED on the Arduino Yun board is flashing at an interval of 1 seconds, with the LEDs labeled L13. If your board is this effect at this point, then congratulations, you are ready for the next study.

This article is selected from: Arduino Yun Quick Start Tutorial University bully Internal information, reproduced please indicate the source, respect the technology respect the IT person!

Arduinoyun tutorial on the Arduino programming environment setup

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.