Whole day I am getting this error on lines 76&77. these are the message lines:
C:\Users\Harry\Documents\Arduino\2022\sketch_jan11b_xtrack\sketch_jan11b_xtrack.ino: In function 'void loop()':
sketch_jan11b_xtrack:76:16: error: expected unqualified-id before '.' token
HCPCA9685.Servo(SERVO_X, newXval);
^
sketch_jan11b_xtrack:77:16: error: expected unqualified-id before '.' token
HCPCA9685.Servo(SERVO_Y, newYval);
^
Allready reinstalled the used libraries. Could anyone tell what I missed here??
#include <HCPCA9685.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
#define LCD_ROWS 2
#define LCD_COLS 16
#define I2C_ADR 0x40
void setup() {
Serial.begin(9600);
lcd.begin(LCD_COLS, LCD_ROWS);
lcd.clear();
lcd.print("XtrackTerm V0.0f");
delay(2000);
lcd.clear();
HCPCA9685 HCPCA9685(I2C_ADR);
/* Wake the device up */
HCPCA9685.Sleep(false);
// lcd.setCursor(0, 1);
lcd.print("Waiting for data");
Serial.println(">>initialized");
}
// Where receiving a string like 123.45,123.67\n
const int MAX_LEN = 14; // the max digits in the number plus decimal point
char strInput[MAX_LEN + 1]; // add one for the terminating null
char *strXval; // ASCII X axis
char *strYval; // ASCII Y axis
int SERVO_X = 2; // Servo X-axis
int SERVO_Y = 3; // Servo Y-axis
int str_Index = 0; // conter for receiving string characters
int s = millis() / 1000;
float newXval = atof(strXval);
float newYval = atof(strYval);
void loop() {
//Check to see if anything is available in the serial receive buffer
while (Serial.available() > 0)
{
static char strValue[MAX_LEN]; // hold the incoming message
char inByte = Serial.read(); //Read the next available byte
//Message coming in (check not terminating character) and guard for over message size
if ( inByte != '\n' && (str_Index < MAX_LEN - 1) )
{
lcd.print("Receiving data ");
//Add the incoming byte to our message
strValue[str_Index++] = inByte;
} // end if
//Full message received...
else
{
//Add null character to string
strValue[str_Index] = '\0';
/* ===== Print the message (or do other things) === */
//Serial.println(strValue);
lcd.clear();
lcd.println(" Data Received ");
strValue[str_Index] = 0;
//Serial.println(strValue);
/* ===== Create the X and Y valueu from received messGE ===== */
strXval = strtok(strValue, ",");
strYval = strtok(NULL, ",");
//Serial.print("X-Axix value = "); Serial.println(strXval);
//Serial.print("Y-Axix value = "); Serial.println(strYval);
/* ===== Update LCD screen row=1 ===== */
lcd.setCursor(0, 1);
lcd.print("X=");
lcd.print(strXval);
lcd.setCursor(8, 1);
lcd.print("Y=");
lcd.print(strYval);
/* ===== Reset for the next message ===== */
str_Index = 0;
strValue[str_Index] = "\0";
/* ====================================== */
//updateServo();
// HCPCA9685.Servo(SERVO_X, newXval);
// HCPCA9685.Servo(SERVO_Y, newYval);
} // end else
} // end while
}// end loop()