【问题标题】:Arduino IDE giving error for the following codeArduino IDE 给出以下代码错误
【发布时间】:2021-08-21 00:43:22
【问题描述】:

代码编译正常,但无法上传。 代码是:

int fsrPin = 0;     // the FSR and 10K pulldown are connected to a0
int fsrReading;     // the analog reading from the FSR resistor divider
 
void setup(void) {
  Serial.begin(115200);   
}
 
void loop(void) {
  fsrReading = analogRead(fsrPin);  
 
  Serial.print("Analog reading = ");
  Serial.print(fsrReading);     // print the raw analog reading
 
  if (fsrReading < 10) {
    Serial.println(" - No pressure");
  } else if (fsrReading < 200) {
    Serial.println(" - Light touch");
  } else if (fsrReading < 500) {
    Serial.println(" - Light squeeze");
  } else if (fsrReading < 800) {
    Serial.println(" - Medium squeeze");
  } else {
    Serial.println(" - Big squeeze");
  }
  delay(1000);
}

而且报错是这样的:

avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x41
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x41

我已经检查了所有端口和代码,一切似乎都很好,但 avr dude 错误不断弹出

【问题讨论】:

标签: arduino ide runtime-error uploading


【解决方案1】:

似乎与 USB 电缆和 Arduino 的连接有些松动。您可以按照以下几个步骤进行反击:

  1. 尝试重新连接 USB 数据线。
  2. 重启 Arduino IDE。
  3. 重启电脑。

你的问题应该解决了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-02-16
    • 1970-01-01
    • 1970-01-01
    • 2021-04-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-13
    相关资源
    最近更新 更多