官术网_书友最值得收藏!

  • Arduino by Example
  • Adith Jagadish Boloor
  • 232字
  • 2021-07-16 20:06:32

Hello World

The easiest way to start working with Arduinos begins here. You'll learn how to output print statements. The Arduino uses a Serial Monitor for displaying information such as print statements, sensor data, and the like. This is a very powerful tool for debugging long codes. Now for your first code!

Writing a simple print statement

Open up the Arduino IDE and copy the following code into a new sketch:

void setup() {
Serial.begin(9600);
Serial.println("Hello World!");
}

void loop() {
}

Open Tools | Board and choose Arduino UNO, as shown in the following screenshot:

Writing a simple print statement

Open Tools | Port and choose the appropriate port (remember the previous COM xx number? select that), as shown in the following screenshot. For Mac and Linux users, once you have connected the Arduino board, going to Tools | Serial Port will give you a list of ports. The Arduino is typically something like /dev/tty.usbmodem12345 where 12345 will be different.

Writing a simple print statement

Selecting the Port

Finally, hit the Upload button. If everything is fine, the LEDs on the Arduino should start flickering as the code is uploaded to the Arduino. The code will then have uploaded to the Arduino.

To see what you have accomplished, click on the Serial Monitor button on the right side and switch the baud rate on the Serial Monitor window to 9600.

You should see your message Hello World! waiting for you there.

主站蜘蛛池模板: 南昌县| 奉新县| 平陆县| 许昌市| 武义县| 琼中| 建瓯市| 无锡市| 云安县| 漠河县| 昌邑市| 宜春市| 温泉县| 石狮市| 名山县| 天津市| 自贡市| 遂川县| 简阳市| 扬中市| 罗田县| 桦甸市| 石首市| 湖南省| 崇州市| 东乌珠穆沁旗| 六枝特区| 双桥区| 巫山县| 彭州市| 襄垣县| 盐山县| 五台县| 龙井市| 安吉县| 东至县| 淅川县| 邢台县| 武功县| 全椒县| 伊金霍洛旗|