ATtiny85 - pulseInLong - SOLVED

I am trying to use the ATtiny and the instruction: pulseInLong.

However - I cannot get a correct result when measuring the incomming pulse.

( I have the same code working perfectly on Arduino Uno).

Is the instruction pulseInLong not availible on ATtiny?

You have some code. You failed to post it. You have some input to the not-an-Arduino. You did not describe it. You have some output from the program that you say is wrong. You did not post the output or explain why you think it is wrong.

So, really, how can anyone help you?

Ok, I only asked, if the instruction pulseInLong is availible on ATtiny85?

I did not think a code was need for the question.

But this is the code line:

void Hz(){ freq = 1000000.0 / ((float)pulseInLong(kHz, HIGH) + pulseInLong(kHz, LOW)); }

It is a simpel code line which is working very well for me on Arduino Uno i several sketches.

Does the code compile? If so, then the compiler understands that the pulseInLong() function exists, and what arguments it takes, and their types.

Does the code link? Then the linker was able to find the object file containing the pulseInLong() function.

Thank you, that make sense. Yes - the code compile.

The next comment is a bit more "open" for me. Does that mean - link to / include a file with the pulseInLong function?

If so I am NOT sure but I now have a direction for a solution.

There are three parts to getting a sketch from the IDE to the Arduino (or wanna-be). The first step is to compile all the source files, to create object files. That's the compiler's job. The second step is to link all the object files (or parts of) together to make an executable (or something that passes for one). That's the linker's job. The third step is to actually upload the executable (or something that passes for one) to the Arduino (or wanna-be). That's avrdude's job, whoever he/she is.

The code compile.
The code also load into the ATtiny85.

The ATtiny85 works - the result of 2 Vrms measurements are shown on the display.

The result of the frequency (pulseInLong) finction is rubbich - a line with strange characters.

Here is the complete (attached)

Project-18.4.2-RMS-Voltmeter-ATtiny85.ino (5.03 KB)

The problem is solved. For me the solution was the important info from PaulS,

Does the code compile? If so, then the compiler understands that the pulseInLong() function exists, and what arguments it takes, and their types.

Then I startet to look for problems in the rest of the code and interface with the OLED display.

The solution was variable type for displaying the measured frequency. When I changed this to int. - the full code is working.

Thank you PaulS.