|
要编写代码并将其上传到Arduino开发板,您需要一台PC或笔记本电脑。但是,有更便宜的方式。在本篇文章中,您将学习如何在Raspberry Pi上安装ARDUINO IDE,用它编写代码然后将其上传到您的Arduino。
所需材料 ● 树莓派3B或B+ ● Arduino UNO R3开发板 ● Arduino IDE
在Raspberry Pi上安装Arduino IDE 请按照以下步骤安装Arduino IDE: 第一步:从Arduino网站下载软件 将Raspberry Pi连接到互联网并在浏览器中输入以下URL:https://www.arduino.cc/en/Main/Software。 下载基于ARM处理器的Linux操作系统Arduino软件。
第二步:解压缩文件 右键单击该文件,然后选择Extract Here。
第三步:安装软件 双击install.sh文件,选择Execute或Execute in Terminal。
这样就完成了。现在,您可以轻松编写Arduino代码并将其上传到开发板,无需PC或笔记本电脑。
Arduino IDE的初始测试 安装软件后,您可以在桌面或“Programming”菜单中访问它。
首先,您可以在File>Examples中使用准备好的Arduino示例。在这里,我们使用的是Blinking LED示例。 - /*
- Blink
- Turns on an LED on for one second, then off for one second, repeatedly.
- Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
- it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN takes care of using the correct LED pin whatever is the board used.
- If you want to know what pin the on-board LED is connected to on your Arduino model, check
- the Technical Specs of your board at https://www.arduino.cc/en/Main/Products
-
- This example code is in the public domain.
- modified 8 May 2014
- by Scott Fitzgerald
-
- modified 2 Sep 2016
- by Arturo Guadalupi
- */
- // 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
- }
复制代码要将代码上传到Arduino,请转到“Tools”菜单,然后选择开发板的类型以及Arduino连接到的串口。 注意:该软件还支持带有CH340G驱动程序的非原装Arduinos,无需单独安装驱动程序。
然后,只需点击upload。
以上就是本篇文章的全部内容。如果遇到任何问题,请随时在本帖下面进行回复。 |