串口不工作()在JetBrains CLion的Arduino上

时间:2016-06-16 06:13:31

标签: arduino-uno clion jetbrains-ide

在Arduino Uno上测试时,代码工作正常,(编辑延迟(x)影响led),  但我收到此错误,串口监视器没有显示任何内容。

CLion事件日志中的错误是:

Error running Unnamed: Cannot run program "C:\Users\Nikhil Verma\.CLion12\system\cmake\generated\4b320303\4b320303\Debug\summer.elf" (in directory "C:\Users\Nikhil Verma\.CLion12\system\cmake\generated\4b320303\4b320303\Debug"): CreateProcess error=193, %1 is not a valid Win32 application

的CMakeLists.txt

cmake_minimum_required(VERSION 2.8.4)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/ArduinoToolchain.cmake)
set(PROJECT_NAME summer)
project(${PROJECT_NAME})

set(${CMAKE_PROJECT_NAME}_BOARD uno)
set(${CMAKE_PROJECT_NAME}_PORT COM1)
set(${CMAKE_PROJECT_NAME}_SKETCH summer.ino)
generate_arduino_firmware(${CMAKE_PROJECT_NAME})

summer.ino

 #include <Arduino.h>
  void setup() {
    pinMode(13, OUTPUT);
    Serial.begin(9600);
}

void loop() {
    Serial.println("Hi");
    digitalWrite(13, HIGH);
    delay(7000);
    digitalWrite(13, LOW);
    delay(1000);
}

配置:

enter image description here

Messaging Build的日志:

"C:\Program Files (x86)\JetBrains\CLion 1.2.4\bin\cmake\bin\cmake.exe" --build "C:\Users\Nikhil Verma\.CLion12\system\cmake\generated\4b320303\4b320303\Debug" --target upload -- -j 8
[ 89%] Built target uno_CORE
[100%] Built target summer

        avrdude.exe: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude.exe: Device signature = 0x1e950f
avrdude.exe: reading input file "C:/Users/Nikhil Verma/.CLion12/system/cmake/generated/4b320303/4b320303/Debug/summer.hex"
avrdude.exe: writing flash (2370 bytes):

Writing | ################################################## | 100% 0.54s

avrdude.exe: 2370 bytes of flash written
avrdude.exe: reading input file "C:/Users/Nikhil Verma/.CLion12/system/cmake/generated/4b320303/4b320303/Debug/summer.eep"
avrdude.exe: writing eeprom (0 bytes):

Writing | ################################################## | 100% -0.00s

avrdude.exe: 0 bytes of eeprom written

avrdude.exe done.  Thank you.

[100%] Built target summer-upload
[100%] Built target upload

"C:\Program Files (x86)\JetBrains\CLion 1.2.4\bin\cmake\bin\cmake.exe" --build "C:\Users\Nikhil Verma\.CLion12\system\cmake\generated\4b320303\4b320303\Debug" --target summer -- -j 8
[ 89%] Built target uno_CORE
[100%] Built target summer

CMake工具链:

enter image description here

感谢。

2 个答案:

答案 0 :(得分:0)

显然您已在工具中启用调试配置,并且您的工具尝试直接在您的计算机上执行Arduino Binary

Error running Unnamed: Cannot run program "C:\Users\Nikhil Verma\.CLion12\system\cmake\generated\4b320303\4b320303\Debug\summer.elf" (in directory "C:\Users\Nikhil Verma\.CLion12\system\cmake\generated\4b320303\4b320303\Debug"): CreateProcess error=193, %1 is not a valid Win32 application

我建议您修改 IDE配置以跳过此步骤,然后代码上传到设备。

编辑:我使用this approach来设置所有项目的 Makefile ,但由于您在Windows上,配置可能会发生变化。

答案 1 :(得分:0)

我有同样的问题。 解决方案是不要单击“运行”(绿色播放)按钮,而是单击右上角的build来运行上传。