Hey everyone, I'm new to coding on Arduino and just can't figure out an error occurring in my code. I am getting an Compilation error: expected primary-expression before '<=' token
Below is my entire code:
#include <Servo.h>
Servo myservo;
int pos = 0;
//www.elegoo.com
//2016.12.08
#include "SR04.h"
#define TRIG_PIN 12
#define ECHO_PIN 11
SR04 sr04 = SR04(ECHO_PIN,TRIG_PIN);
long a;
void setup() {
Serial.begin(9600);
myservo.attach(9);
Serial.begin(9600);
delay(1000);
}
void loop() {
a=sr04.Distance();
Serial.print(a);
Serial.println("cm");
delay(1000);
if (a)<= 40;
for (pos = 0; pos <= 180; pos += 1) {
// in steps of 1 degree
myservo.write(pos);
delay(1);
}
for (pos = 180; pos >= 0; pos -= 1) {
myservo.write(pos);
delay(1);
}
}
PLS PLS PLS help!!