风筝
发表于: 2019-8-15 11:09:01 | 显示全部楼层

要编写代码并将其上传到Arduino开发板,您需要一台PC或笔记本电脑。但是,有更便宜的方式。在本篇文章中,您将学习如何在Raspberry Pi上安装ARDUINO IDE,用它编写代码然后将其上传到您的Arduino。


所需材料

●    树莓派3B或B+

●    Arduino UNO R3开发板

●    Arduino IDE

Raspberry-ArduinoIDE-required-materials.jpg


在Raspberry Pi上安装Arduino IDE

请按照以下步骤安装Arduino IDE:

第一步:从Arduino网站下载软件

将Raspberry Pi连接到互联网并在浏览器中输入以下URL:https://www.arduino.cc/en/Main/Software

下载基于ARM处理器的Linux操作系统Arduino软件。

Raspberry-ArduinoIDE-download-1.jpg


第二步:解压缩文件

右键单击该文件,然后选择Extract Here


第三步:安装软件

双击install.sh文件,选择ExecuteExecute in Terminal

Raspberry-ArduinoIDE-install.jpg

这样就完成了。现在,您可以轻松编写Arduino代码并将其上传到开发板,无需PC或笔记本电脑。


Arduino IDE的初始测试

安装软件后,您可以在桌面或“Programming”菜单中访问它。

Raspberry-ArduinoIDE-ide1.jpg

Raspberry-ArduinoIDE-ide2.jpg


首先,您可以在File>Examples中使用准备好的Arduino示例。在这里,我们使用的是Blinking LED示例。

  1. /*
  2.   Blink
  3.   Turns on an LED on for one second, then off for one second, repeatedly.

  4.   Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
  5.   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.
  6.   If you want to know what pin the on-board LED is connected to on your Arduino model, check
  7.   the Technical Specs of your board  at https://www.arduino.cc/en/Main/Products
  8.   
  9.   This example code is in the public domain.

  10.   modified 8 May 2014
  11.   by Scott Fitzgerald
  12.   
  13.   modified 2 Sep 2016
  14.   by Arturo Guadalupi
  15. */
  16. // the setup function runs once when you press reset or power the board
  17. void setup() {
  18.   // initialize digital pin LED_BUILTIN as an output.
  19.   pinMode(LED_BUILTIN, OUTPUT);
  20. }

  21. // the loop function runs over and over again forever
  22. void loop() {
  23.   digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  24.   delay(1000);                       // wait for a second
  25.   digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  26.   delay(1000);                       // wait for a second
  27. }
复制代码

要将代码上传到Arduino,请转到“Tools”菜单,然后选择开发板的类型以及Arduino连接到的串口。

注意:该软件还支持带有CH340G驱动程序的非原装Arduinos,无需单独安装驱动程序。

Raspberry-ArduinoIDE-port-1.jpg

然后,只需点击upload

Raspberry-ArduinoIDE-done.jpg


以上就是本篇文章的全部内容。如果遇到任何问题,请随时在本帖下面进行回复。

跳转到指定楼层
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题 700 | 回复: 1480



手机版|

GMT+8, 2024-4-25 02:26 , Processed in 0.039392 second(s), 6 queries , Gzip On, MemCache On. Powered by Discuz! X3.5

YiBoard一板网 © 2015-2022 地址:河北省石家庄市长安区高营大街 ( 冀ICP备18020117号 )

快速回复 返回顶部 返回列表