/*
pulseIn
This sketch allows to test pulseIn() and pulseInLong() functions.
A PWM signal is generated on 'pwm' pin and then measures are performed on
'in' pin for the HIGH and LOW state.
The min and max value for both are displayed on the Serial console.
Creation 15 Sep 2017
by Frederic Pillon
This example code is in the public domain.
https://www.arduino.cc/en/Reference/PulseIn
*/
/*
// Use pulseInLong()?
#define USE_PULSEINLONG 1
static uint32_t pwm = 4;
static uint32_t in = 5;
static uint32_t state = LOW;
void setup() {
pinMode(in, INPUT);
Serial.begin(115200);
analogWrite(pwm, 127);
}
void loop() {
uint32_t duration = 0;
duration = pulseIn(in, state);
//uint32_t durationLong = 0;
//durationLong = pulseInLong(in, state);
Serial.println(duration);
//Serial.println(durationLong);
Serial.println();
delay(1000);
}*/
void setup() {
pinMode(4, OUTPUT);
}
void loop(){
digitalWrite(4,LOW);
delay(1000);
digitalWrite(4,HIGH);
delay(1000);
}Loading
stm32-bluepill
stm32-bluepill