Preparation
I have not bought the source plate. I have purchased the compatible plate from an authorized supplier. For authorized suppliers in mainland China, visit
Http://arduino.cc/en/Main/Buy page, search for China.
I purchased an Arduino Ethernet compatible Board. For the source board, see here:
Http://arduino.cc/en/Main/ArduinoBoardEthernet compatible board has some changes.
In order to connect the computer with the source board and the compatible board, you not only need to connect the cable, but also need to download the corresponding driver for the compatible board I purchased to use USB cable connection, the driver depends on the compatible board. Contact the supplier. Note that different drivers are required for different operating systems, such as Windows, Mac OS X, and Linux.
To compile the program, you also need to download the integrated development environment, Arduino IDE
Http://arduino.cc/en/Main/Software, pay attention to Windows, Mac OS X and Linux need to download different programs.
Arduino uses a programming language similar to C language and requires a certain degree of C language. For detailed syntax, see
Http://arduino.cc/en/Reference/HomePage
Please indicate the original position of the post:
Http://aiyingjian.com/forum.php? MoD = viewthread & tid = 4
Arduino Hello 3 Description
The preceding two examples are output to the Digital Port. They are only in the high-voltage and low-level states. This is not a habit for programmers who are familiar with software development and debugging, even the most primitive command line programming should have character output. This example shows how to listen to the Arduino output characters through the serial port on the computer.
Arduino Hello 3 Program
int i = 0;void setup(){ Serial.begin(9600);}void loop(){ Serial.print("Hello World! from Arduino! "); Serial.println(i++); delay(1000);}
Arduino Hello 3 program structure
int i = 0;
Declare a variable I with the initial value 0 for counting.
Serial.begin(9600);
Initialize the serial port and set the transmission speed of the serial port to 9600, that is, 9600 bits per second.
Serial.print("Hello World! from Arduino! ");
Output A string through a serial port.
Serial.println(i++);
Output variable I via serial port and wrap it, variable I auto-incrementing.
delay(1000);
The latency is 1000 milliseconds.
Test
Click the "file" menu and click the "Download" menu item. Arduino ide automatically compiles the program and downloads it to the Arduino board. Click "Tools" and click "Serial monitor" to open the serial monitor window. The output content is as follows:
Hello World! from Arduino! 0Hello World! from Arduino! 1Hello World! from Arduino! 2Hello World! from Arduino! 3Hello World! from Arduino! 4Hello World! from Arduino! 5Hello World! from Arduino! 6Hello World! from Arduino! 7Hello World! from Arduino! 8Hello World! from Arduino! 9Hello World! from Arduino! 10
You can also press Ctrl + Shift + m to open the window.
Description
Serial.begin(9600);
The transmission speed in the function can be 300,600,120 0, 2400,480 0, 9600,144 00, 19200,288 00, 38400,576 00, or 115200. However, you must set the same rate in the serial port monitor to receive the correct information.
Serial.print("Hello World! from Arduino! ");
The function outputs only the content without line breaks. The content can be of various types of data.
Serial.println(i++);
Function output content and line feed. The content can be of various types or include operations as shown in this example.