My apologies, I am a new member and thus are unable to upload the code in question.
I cannot for the life of me understand how I am getting (exit status 1
expected unqualified-id before '.' token)
I have looked for the missing ; but no luck.
Surley there is a wizard who can resolve this?
#include <LiquidCrystal.h>
// AC Frequency with LCD By Solarduino
// 0- General
int decimalPrecision = 2;
// 1- frequency measurement
unsigned long startMicros;
unsigned long currentMicros;
int expectedFrequency = 50;
int frequencyAnalogPin = A2;
float frequencySampleCount = 0;
float frequency =0 ;
float a;
float switch01 = 0;
float vAnalogRead = 0;
// 2 - LCD Display
// Include Wire Library for I2C
#include <Wire.h>
// Include NewLiquidCrystal Library for I2C
#include <LiquidCrystal_I2C.h>
// Define LCD pinout
const int en = 2, rw = 1, rs = 0, d4 = 4, d5 = 5, d6 = 6, d7 = 7, bl = 3;
// Define I2C Address - change if reqiuired
const int i2c_addr = 0x27;
LiquidCrystal_I2C lcd(i2c_addr, en, rw, rs, d4, d5, d6, d7, bl, POSITIVE);
void setup()
{
// 0- General
Serial.begin(9600);
// 1- frequency measurement
startMicros = micros();
// 2 - LCD Display
LCD.begin(16,2);
LCD.setCursor(0,0);
startMicrosLCD = micros();
}
void loop()
{
// 1- frequency measurement
currentMicros = micros();
vAnalogRead = analogRead(frequencyAnalogPin) - 512;
if(vAnalogRead >=0 && switch01 == 0)
{
frequencySampleCount = frequencySampleCount +1 ;
switch01 = 1;
}
if(vAnalogRead < 0 && switch01 == 1) { switch01 = 0; } if(frequencySampleCount == expectedFrequency) { a = currentMicros-startMicros ; frequency = 1/((a/1000000)/frequencySampleCount); Serial.print(frequency,decimalPrecision); Serial.println(" Hz"); startMicros = currentMicros; frequencySampleCount = 0; // 2 - LCD Display currentMicrosLCD = micros(); if(currentMicrosLCD - startMicrosLCD >=1000000)
{
LCD.setCursor(0,0);
LCD.print("f=");
LCD.print(frequency,decimalPrecision);
LCD.print("Hz ");
LCD.setCursor(0,1);
LCD.print(" ");