我有一个 Arduino Mega 2560 微控制器。它一直运行良好,直到大约两天前,我在 Windows 10 笔记本电脑上双启动了 Ubuntu 18.04 LTS。从那时起,在线 Arduino 创建 IDE 在将代码上传到我的微控制器时出现问题……每次都出现此错误,即使在桌面 IDE 上也是如此。我已经寻找解决方案很长时间了,但没有任何效果。
Sketch uses 2812 bytes (1%) of program storage space. Maximum is 253952 bytes.
Global variables use 67 bytes (0%) of dynamic memory, leaving 8125 bytes for local variables. Maximum is 8192 bytes.
Programming with: Serial
Flashing with command:/home/sai/.arduino-create/arduino/avrdude/6.3.0-arduino14/bin/avrdude -C/home/sai/.arduino-create/arduino/avrdude/6.3.0-arduino14/etc/avrdude.conf -v -patmega2560 -cwiring -P/dev/ttyACM0 -b115200 -D -Uflash:w:/tmp/arduino-create-agent634272836/lcd_and_ultrasonic.hex:i
avrdude: Version 6.3-20171130
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "/home/sai/.arduino-create/arduino/avrdude/6.3.0-arduino14/etc/avrdude.conf"
User configuration file is "/home/sai/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : /dev/ttyACM0
Using Programmer : wiring
Overriding Baud Rate : 115200
avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied
ioctl("TIOCMGET"): Inappropriate ioctl for device
ioctl("TIOCMGET"): Inappropriate ioctl for device
答案1
下面这一行告诉了你这个问题:
avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied
获得串行设备读/写权限的规范方式是成为dialout
组成员。
假设您的用户名是,sai
并且您以该用户身份运行 IDE/浏览器,则将该用户添加到组的命令dialout
是:
sudo usermod -a -G dialout sai
您需要注销并重新登录才能使更改生效。