Frequency Measurement on an Orangutan SV-328.

Hi everybody.

So, I am currently writing some code to measure the frequency of a square wave, and to print it to and LCD screen using an Orangutan SV-328 board. I have the Orangutan configured to work with Arduino IDE. However, I am getting an error in the code and I need some help. This is my first time coding in Arduino IDE but I do have some previous coding with Microsoft Visual Basic.

Here is the code in question:

#include <FreqMeasure.h>
#include <OrangutanLCD.h>
#include <OrangutanAnalog.h>

OrangutanLCD lcd;
OrangutanAnalog analog;


void setup() {
    analog.setMode(MODE_8_BIT); // 5V has a bit value of 256 (2^8 = 256)
    Serial.begin(57600);
    lcd.print("Freq:");
    FreqMeasure.begin();
}

double sum = 0;
int count = 0;

void loop() {
    int input = analog.read(5); 
    if (FreqMeasure.available()) {
      sum = sum + FreqMeasure.read();
      count = count + 1;
    if (count > 30) {
      float frequency = FreqMeasure.countToFrequency(sum / count);
      lcd.print(frequency);
      lcd.print("       ");
      sum = 0;
      count = 0;
    }
  }
}

The line that is giving the error is the lcd.print(frequency)

Here are the errors:

call of overloaded'print(float&)' is ambiguous
note: candidates are: static void OrangutanLCD::print(char)
                                           static void OrangutanLCD::print(unsigned char)
                                           static void OrangutanLCD::print(long unsigned int)
                                           static void OrangutanLCD::print(long int)
                                           static void OrangutanLCD::print(unsigned int)
                                           static void OrangutanLCD::print(int)

It may have something to do with the <OrangutanLCD.h> header file but I am not sure what changes I need to make to it.

Any help would be greatly appreciated. Thanks.

It appears that lcd.print does not support floating point numbers. You will have to convert the float to one or more integers (i.e. treat the fraction separately if it interests you) and then print the result.

It would be easier to do the formatting yourself and just print the string. You could do that by multiplying the float value by ten for each decimal place you want in the answer, convert to int, use div (/) to get the decimal part and mod (%) to get the fractional part, use snprintf() to print those parts into a single c-string with leading zeros for the fractional part, then print the string to the display.