Timing between 2 events

Really helpful. Thanks a lot.

You are right ! :wink:

If I want to display 1 decimal (0.2mSec instead of 0.233mSec), how I can do ?

image

Thank you,
V5D

on ESP32 use a %.1f conversion specification

    Serial.printf("rising edge-to-edge time %luuSec %.1fmSec \n", pulseStart2,
                  pulseStart2 / 1000.0e0);

if using Serial.print() see reference/cs/language/functions/communication/serial/print/

How is X in function Serial.print (1.23456, X ) gives "1.2" ?

Thank you,
V5D

Did you try 1?

Yes. It's OK. Got it. Thanks !

Hello,

By accident, I got this error message below.

Could you please explain why it is ? Can I have to delete the LiquidCrystal and reinstall all ?

Thank you.
V5D

Hello,

My question is IF I need to have a resistor (pull down) 10K at input #2 or #3 ?

Thank you,
V5D

... and what happens IF I configure pinMode (9, input_pullup) ? Thanks

think you need to post the complete program or at least a small program which demonstrates the problem
what host microcontroller are you using?
what Tools>Board have you selected?

... Sorry, Pin D9 and pin D10 (not D2, D3) as shematic. Thanks

You don't need an external pulldown if you mode the pin INPUT_PULLUP. You wire the pin directly to GND.
When the button is up, the switch is Open, the chip supplies 5V through 20K to 50K Ohms resistance. The pin is charged HIGH.
When the button is down, the switch to GND is Closed and the pin is held LOW.

Don't just watch the pin state. Watch for changes in the pin state. Keep track of the last read before making the next and compare to detect change.

Does the Nano Every run on an ATmega328P chip?

The 2 Input pins (2 output pins are disconnected) are connected to GND by resistors 10K and receiving 2 PWM signals external. It's OK when the inputs PWM signals at LOW, but when at HIGH, the voltage measured only 3V, not 5V amplitude (with pinMode (2, input) function).
I will try with pinMode(2, input_pullup) to get 5V at HIGH level...

Thanks for replying,
V5D

They may be driven up by the external signal with a 3V/10000ohm=30ma 3V/10000ohm=0.3ma signal and perhaps need no pulldown at all.

For buttons you don't feed PWM and you don't put a resistor on the wire to GND. You wire the other side of the switch from the pin straight to GND in order to drain the pin asap and keep it drained while the button is held down.
The chip supplies weak 5V to the pin when moded INPUT_PULLUP (the capitals are necessary). Read LOW means button down (or bouncing), read HIGH means button up (or bouncing). NO external power and NO resistors.

= 0.3ma only

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.