assignment of read-only variable m1a

#define trig 11
#define echo 12
const int m1a=5;
const int m1b=6;
const int m2a=9;
const int m2b=10;

void setup() {
Serial.begin(9600);
pinMode(trig, OUTPUT);
pinMode(echo, INPUT);
}

void loop() {

long duration, distance;
digitalWrite(trig, LOW);
delayMicroseconds(2);
digitalWrite(trig, HIGH);
delayMicroseconds(10);
digitalWrite(trig, LOW);
duration = pulseIn(echo, HIGH);
distance = (duration/2) / 29.1;
if (distance < 10) {
analogWrite(m1a=105);
analogWrite(m1b=0);
analogWrite(m2a=0);
analogWrite(m2b=105);
}
else {
analogWrite(m1a=110);
analogWrite(m1b=0);
analogWrite(m2a=110);
analogWrite(m2b=0);
}
}

Check how analogWrite is supposed to be used.

And the problem is? in hiding with the code tags?

Mark

You are having problems with the syntax of the C programming language.

Google "C++ tutorial", pick any one of the tutorals online, and do the first few chpters of one of them..

No need to look further than top of page. Learning > Tutorials
Learning > Reference is also good.