سلام نیاز به کمک دارم شدیدکد:#define input 4 //#define in 8 #define F1 15 #define F2 16 #define F3 17 #define F4 13 unsigned int high_time; //int h_time; unsigned int low_time; //int l_time; float time_period; //float t_period; float frequency; //float frequenc; void setup() { pinMode(input,INPUT_PULLUP); //pinMode(in,INPUT); pinMode(F1,OUTPUT); pinMode(F2,OUTPUT); pinMode(F3,OUTPUT); pinMode(F4,OUTPUT); Serial.begin(9600); } void loop() { high_time=pulseIn(input,HIGH); low_time=pulseIn(input,LOW); time_period=high_time+low_time; time_period=time_period/1000; frequency=1000/time_period; /* h_time=pulseIn(in,HIGH); l_time=pulseIn(in,LOW); t_period=h_time+l_time; t_period=t_period/1000; frequenc=1000/t_period; */ //Serial.print('frequenc'); Serial.println(frequency); //Serial.print(" Hz"); if (frequency >= 17){ digitalWrite (F1, HIGH); } else if (frequency <=16 ) { digitalWrite (F1, LOW); } if (frequency >= 25){ digitalWrite (F2, HIGH); } else if (frequency <= 24) { digitalWrite (F2, LOW); } if (frequency >= 38){ digitalWrite (F3, HIGH); } else if (frequency <= 37) { digitalWrite (F3, LOW); } if (frequency >= 49){ digitalWrite (F4, HIGH); } else if (frequency <=48){ digitalWrite (F4, LOW); } delay(50); }