# Code error about servo

**URL:** <https://forum.arduino.cc/t/code-error-about-servo/1297694>\
**Category:** Programming\
**Created:** [September 2, 2024, 11:04am UTC](https://forum.arduino.cc/t/code-error-about-servo/1297694 "2024-09-02T11:04:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aloofsquid](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/aloofsquid/32/1100803_2.png) [@aloofsquid](https://forum.arduino.cc/u/aloofsquid)\
**Post date:** [September 2, 2024, 11:04am UTC](https://forum.arduino.cc/t/code-error-about-servo/1297694/1 "2024-09-02T11:04:03Z")

</div>

I made a code but this error keeps showing here is the code

Compilation error: 'myservo' was not declared in this scope

The Code

#include \<Servo.h\>

#define startPoint 75  
#define endPoint 180  
#define servoPin 3

Servo myServo;

void setup() {  
myServo.attach(servoPin);  
myservo.write(startPoint);  
}

void loop() {

}

---

<div class="post-metadata">

**Author:** ![Dave\_Lowther](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/dave_lowther/32/1092885_2.png) [@Dave\_Lowther](https://forum.arduino.cc/u/Dave_Lowther)\
**Post date:** [September 2, 2024, 11:08am UTC](https://forum.arduino.cc/t/code-error-about-servo/1297694/2 "2024-09-02T11:08:04Z")

</div>

> [@aloofsquid](#):
>
> Compilation error: 'myservo' was not declared in this scope

![image](https://europe1.discourse-cdn.com/arduino/original/4X/7/a/6/7a60be79186ccf3bcfb4954853467af079283e15.png)

It should be "myServo" with an upper case 'S'. C++ variable names are case sensitive, so "myServo" is not the same as "myservo".

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [March 1, 2025, 11:08am UTC](https://forum.arduino.cc/t/code-error-about-servo/1297694/3 "2025-03-01T11:08:24Z")

</div>

Closed on March 1, 2025, 11:08am UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
