error message 'no match for operator =' servo+led if statements

currently I’m still relatively new to Arduino and c++ and am working around with several different scenarios to help me improve in c++

I’m trying to get a servo to turn 0, LED turn on from an if statement, servo turn again to 180 from an if statement, turn LED off from an if statement, servo turn back to 0. essentially a endless loop.

however I’m getting error message "no match for the operator, operand types are ‘Servo’ and ‘int’ ".
in the lines " if(myServo =180);{ " and " if(myServo =0);{ ".

which led me to believe that it was an issue with the naming, I “myServo” to “Servo” but no difference.

the full code is below for reference.
any help would be greatly appreciated.

#include <Servo.h>

int ledPin = 7;
int servoPin = 8;
Servo myServo;

void setup() {
myServo.attach(8);
pinMode (ledPin, OUTPUT);
}

void loop() {
myServo.write(0);
if(myServo =0);{
digital.write(ledPin = HIGH);
delay (100);
}
if (ledPin=HIGH);{
myServo.write(180);
delay (100);
}
if(myServo =180);{
digital.write(LOW);
}
if (ledPin=LOW);{
myServo.write(0);
delay(100);
}
}

if(myServo =0);

Issue 1:
Single = or == ?

Issue 2:
If you are expecting myServo to return the position of the servo then you are mistaken. Save the servo position to a variable when you write it and use that variable in the test or use myServo.read()

Next issue:

if (ledPin=LOW); it won't be because int ledPin = 7;

  if(myServo =0);{
    if (ledPin=HIGH);{
    if(myServo =180);{
     if (ledPin=LOW);{

After fixing the = / == issue, get rid of the ';' s.

Did you type that smiley in your code 8) I doubt it. When posting code, please use code tags to prevent the forum software from corrupting it.

Type ``` [code] ```

Paste your code after that Type ``` [/code] ``` after that.

hello world.
as I’m recently new to Arduino coding I’m trying out several scenarios to get a undertsandinng of it.

what I would like to do is make a led turn on, servo turn from that, light turn off from that, servo turn again from that , and loop.

however in code I’m getting errors with “if(myServo =180);{”
saying ‘exit status 1, no match for operator=, operand types are Ser and int’

my guess is that ive screwed up somewhere in the naming of it, however it still seems to elude me.
the full code is down below.
many thanks for any responses.

#include <Servo.h>

int ledPin = 7;
int servoPin = 8;
Servo myServo;

void setup() {
myServo.attach(8);
pinMode (ledPin, OUTPUT);
}

void loop() {
myServo.write(0);
if(myServo =0);{
digital.write(ledPin = HIGH);
delay (100);
}
if (ledPin=HIGH);{
myServo.write(180);
delay (100);
}
if(myServo =180);{
digital.write(LOW);
}
if (ledPin=LOW);{
myServo.write(0);
delay(100);
}
}

use == for comparition

...and lose the semicolons at the end of the if expressions

digital.write(ledPin = HIGH);oops

if(myServo =0)Did you mean to do a read of myServo?

If you are trying to read the position of your servo using

if(myServo =180);

then you are doing it wrong. You set the position of the servo so should know where it is. Save the value previously written to the servo and compare that or use the servo.read() function to determine where the servo was last commanded to go to.

And, as has been pointed out, use == for comparison not =

Hi, I think you were helped here..

https://forum.arduino.cc/index.php?topic=486822.msg3321995#msg3321995

Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code. It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom... :)