// 程式碼 //
int ledPin = 13; // LED connected to digital pin 13
int PhotoSPin = 0; // Photosensitive connected to digital pin 0
int Analog_val =0; // Photosensitive Val
void setup()
{
Serial.begin ( 9600 );
pinMode(ledPin, OUTPUT); // LED
pinMode(PhotoSPin, INPUT); // Photosensitive
}
void loop()
{
digitalWrite(ledPin, HIGH); // set the LED on
delay(Analog_val); // wait for a second
digitalWrite(ledPin, LOW); // set the LED off
delay(Analog_val); // wait for a second
總之這顆要讀取資料得要...
A. 送出一個50us的high訊號
B. 送2~20us的low
C. SERVO會進入"暫停" low 狀態, 約125us
D. SERVO 會"傳回"一個high的訊號, 持續時間550~2450 (就是SERVO目前位置)
E. SERVO 回復LOW 250 us
F . 恢復原狀, SERVO又可繼續受到控制