1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-20 21:01:25 +03:00
Files
esp8266/app/preproc/test/data/foo1.cpp

22 lines
271 B
C++

int encoder = 4;
unsigned long speed = 0;
void setup()
{
pinMode(encoder, INPUT);
}
void loop()
{
speed = getspeed();
delay(1000);
}
unsigned long getspeed()
{
unsigned long duration = 0;
duration = pulseIn(encoder, HIGH);
return(duration);
}