# readServoAngleNPD(id)

### 参数

| 参数名 | 类型            | 描述              |
| --- | ------------- | --------------- |
| id  | unsigned char | 要控制的ID号，范围0\~18 |

### 返回

| 参数名    | 类型  | 描述                 |
| ------ | --- | ------------------ |
| number | int | 舵机角度，范围-118°\~118° |

### 例子

用uKitExplore v2板子控制1号舵机旋转到-20°，速度为400ms.然后读取并每隔400ms打印一次舵机角度。

```c
#include "uKitExplore2.h"
void setup() {    
    Initialization();    
    setServoAngle(1,-20,400);    
    delay(400);
}

void loop() {    
    Serial.println(readServoAngleNPD(1));    
    delay(400);
}
```

结果：只能读取到舵机角度，舵机掰不动。

用uKitExplore v2板子控制1号舵机从-118°每隔100ms不断加1°，速度为100ms.然后读取并打印一次舵机角度。

```c
#include "uKitExplore2.h"
int Angle=-118;

void setup() {   
    Initialization();
}

void loop() {    
    Angle++;    
    Serial.println(readServoAngleNPD(1));    
    setServoAngle(1,Agnle,100);    
    delay(100);    
    if(Angle>=118){	
        Angle=118;    
    }
}
```

结果：只能读取到舵机角度，舵机掰不动。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ubtechedu.gitbook.io/chinese/standard/servo/readservoanglenpd.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
