#include<Servo.h>
Servo FS90;
byte FS90Pin = 9;
byte analogPinA0 = A0;
float PosS=0.5;
long int cycle;
long int tHigh=1000;
long int tLow=100;
void setup() {
Serial.begin(9600);
}
void loop (){
while (PosS<80){
tHigh = pulseIn(A0, 1);
tLow = pulseIn(A0, 0);
cycle = tHigh+tLow;
PosS = tHigh/cycle;
PosS=PosS*100;
Serial.print("PosS:");
Serial.print(PosS,4);
Serial.print('\n');
Serial.print("cycle:");
Serial.print(cycle);
Serial.print('\n');
Serial.print("tHigh");
Serial.print(tHigh);
Serial.print('\n');
Serial.print("tLow");
Serial.print(tLow);
Serial.print('\n');
}
}