Created
January 13, 2025 21:36
-
-
Save upsilun/75a7ae6f822a245e6583cc683a5d4b20 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int pwmInputPin = 3; | |
void setup() { | |
Serial.begin(9600); | |
pinMode(pwmInputPin, INPUT); | |
Serial.println("Reading PWM signal..."); | |
} | |
void loop() { | |
unsigned long pulseWidth = pulseIn(pwmInputPin, HIGH); | |
if (pulseWidth > 0) { | |
Serial.println(pulseWidth); | |
} else { | |
Serial.println("No signal detected."); | |
} | |
delay(100); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment