Arduino上'('令牌之前的预期标识符

时间:2018-11-10 22:20:50

标签: arduino arduino-ide

我正在Arduino IDE上编写Arduino程序,但我遇到了一个问题,它说这是流浪313错误:在'if'之前应为')'。我该如何纠正?我是编程新手,不知道如何解决它。问题出在最后一个“ if line”上 这是草图

int LED1 = 3;
int LED2 = 5;
int LED3 = 6;
int sensor = 0;
int valor;
void setup() {
  pinMode (LED1, OUTPUT);
  pinMode (LED2, OUTPUT);
  pinMode (LED3, OUTPUT);

}

void loop() {
  valor = analogRead (sensor);
  if ((valor ˃ 0) && (valor ˂ 170)) {
    analogWrite (LED1, 127);
    analogWrite (LED2, 0);
    analogWrite (LED3, 0);
  }
  if ((valor ˃= 170) && (valor ˂ 340)) {
    analogWrite (LED1, 255);
    analogWrite  (LED2, 0);
    analogWrite (LED3, 0);
  }
  if ((valor ˃= 340) && (valor ˂ 510)) {
    analogWrite (LED1, 255);
    analogWrite (LED2, 127);
    analogWrite (LED3, 0);
  }
  if ((valor ˃= 510) && (valor ˂ 680)) {
    analogWrite (LED1, 255);
    analogWrite (LED2, 255);
    analogWrite (LED3, 0);
  }
  if ((valor ˃= 680) && (valor ˂ 850)) {
    analogWrite (LED1, 255);
    analogWrite (LED2, 255);
    analogWrite (LED3, 127);
  }
  if ((valor ˃= 850) && (valor ˂ 1023)) {
    analogWrite (LED1, 255);
    analogWrite (LED2, 255);
    analogWrite (LED3, 255)
  }
  else {
    analogWrite (LED1, 0);
    analogWrite (LED2, 0);
    analogWrite (LED3, 0);
  }
  delay (15);

}

1 个答案:

答案 0 :(得分:0)

您正在为<>使用一些奇怪的字符。也许还有其他一些内容,例如不可破坏的空间,但通常是通过在网络上发布内容来解决的。

另一个错误是在analogWrite()之后没有分号;