Uno or Nano

Hi,

I would like to base a project on a couple of Arduino Nano, the following bits of code would be useful, but pulseIn is referred to as usable with the Uno. with no mention of other boards, neither does it appear in the Help listings.

So is pulseIn built into the "C" compiler, and will work with any Arduino board, or only with the Uno ?.

Htime=pulseIn(8,HIGH); Ltime=pulseIn(8,LOW);

start = millis();

Thanks in advance Dave P..

Nano is essentially the same as the Uno, only in a different form factor. Any code that works on an Uno is guaranteed to work on a Nano.

The Nano uses the same ATmega328p processor as the UNO and is software compatible in almost every way (it uses a different chip package which give it two more analog inputs).

Where does it say "UNO"?

https://www.arduino.cc/reference/en/language/functions/advanced-io/pulsein/ This version counts loops so time spent in interrupts is not counted. Can be run with interrupts disabled.

https://www.arduino.cc/reference/en/language/functions/advanced-io/pulseinlong/ This new version uses micros() so interrupts have less effect on the result. Can't be used with interrupts disabled.

Thanks for the replies guys, I found the "pulseIn" statement in code for a frequency counter at :- https://circuitdigest.com/microcontroller-projects/arduino-frequency-counter-circuit

the text with it stated :- The Uno has a special function pulseIn, which enables us to determine the positive state duration or negative state duration of a particular rectangular wave:

This made me think that pulseIn only applied to the Uno, as this is my first project using an Arduino I did not want to write code using it only to find it did not apply to the Nano.

Dave P..

MothingMan: the text with it stated :-

The Uno has a special function pulseIn, which enables us to determine the positive state duration or negative state duration of a particular rectangular wave

I think that was a typo. They probably meant to say "Arduino" instead of "UNO"

PulseIn is simply a timing function the measures how long a signal remains at the prescribed level. It is a hardware abstraction that alleviates your need to understand pin/port/timer definitions. The same function could be written for any MCU that has the necessary peripherals. For that matter, you could accomplish the same thing with a timing loop of your own and call it anything you want.

Thanks for the info, that clarifies what the function is. Dave P..

[ SOLVED ] I cannot find a way to edit the header for this.

MothingMan: I cannot find a way to edit the header for this.

http://forum.arduino.cc/index.php?topic=148850.msg1118325#msg1118325