1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-03 14:24:15 +01:00
Arduino/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);
}