Hi, any idea about this error.
C:\Users\Josia\Desktop\Ali Yasir\Zeitwaage\Zeitwaage.ino: In function 'void setup()':
Zeitwaage:217:13: error: 'class NexText' has no member named 'PopCallBack'
LiftAngle.PopCallBack(LiftAnglePopCallBack);
^
At global scope:
cc1plus.exe: warning: unrecognized command line option '-Wno-frame-address'
exit status 1
'class NexText' has no member named 'PopCallBack'
//#include <SoftwareSerial.h>
#include <Nextion.h>
#include <filters.h>
#include <SPI.h>
#define SS 5
/********************************************************************
Filter Setting, LPF
********************************************************************/
const float cutoff_freq = 125.0; /* Cutoff frequency in Hz */
const float sampling_time = 0.001; /* Sampling time in seconds. */
IIR::ORDER order = IIR::ORDER::OD4; /* Order (OD1 to OD4) */
Filter f(cutoff_freq, sampling_time, order);
/********************************************************************
Variables
********************************************************************/
int n = 0;
int count = 0;
int start_time;
int end_time;
uint16_t number;
const unsigned long event = 5000;
/********************************************************************
Nextion Function
********************************************************************/
void ButtonMinusPopCallBack(void *ptr);
void ButtonPlusPopCallBack(void *ptr);
void ButtonWeiterPopCallBack(void *ptr);
void ButtonEnterPopCallBack(void *ptr);
void ButtonClosePopCallBack(void *ptr);
void LiftAnglePopCallBack(void *ptr);
/********************************************************************
Nextion component for page0
********************************************************************/
NexButton ButtonWeiter = NexButton(0, 1, "ButtonWeiter");
/********************************************************************
Nextion component for page1
********************************************************************/
NexText LiftAngle = NexText(1, 1, "LiftAngle");
NexButton ButtonMinus = NexButton(1, 2, "ButtonMinus");
NexButton ButtonPlus = NexButton(1, 3, "ButtonPlus");
NexButton ButtonEnter = NexButton(1, 4, "ButtonEnter");
/********************************************************************
Nextion component for page2
********************************************************************/
NexButton ButtonClose = NexButton(2, 1, "ButtonClose");
NexText Rate = NexText(2, 2, "Rate");
NexText Amplitude = NexText(2, 3, "Amplitude");
NexText BeatError = NexText(2, 4, "BeatError");
NexText BeatRate = NexText(2, 5, "BeatRate");
/********************************************************************
Nextion screens
********************************************************************/
NexPage zero = NexPage(0, 0, "zero");
NexPage one = NexPage(1, 0, "one");
NexPage two = NexPage(2, 0, "two");
/********************************************************************
Buffer zone of various variables
********************************************************************/
char buffer[100] = {0};
char buffer_Rate[10] = {0};
char buffer_Amplitude[10] = {0};
char buffer_BeatError[10] = {0};
char buffer_BeatRate[10] = {0};
char buffer_LiftAngle[10] = {0};
NexTouch *nex_listen_list[] =
{
&ButtonClose,
&ButtonEnter,
&ButtonPlus,
&ButtonMinus,
&ButtonWeiter,
&LiftAngle,
NULL
};
/********************************************************************
Lift Angle Function
********************************************************************/
void LiftAnglePopCallBack(void *ptr)
{
dbSerialPrintln("LiftAnglePopCallBack");
LiftAngle.setText("52");
}
/********************************************************************
Button Minus Function
********************************************************************/
void ButtonMinusPopCallBack(void *ptr)
{
uint16_t len;
dbSerialPrintln("ButtonMinusPopCallBack");
memset(buffer, 0, sizeof(buffer));
LiftAngle.getText(buffer, sizeof(buffer));
number = atoi(buffer);
number -= 1;
memset(buffer, 0, sizeof(buffer));
itoa(number, buffer, 10);
LiftAngle.setText(buffer);
}
/********************************************************************
Button Plus Function
********************************************************************/
void ButtonPlusPopCallBack(void *ptr)
{
uint16_t len;
dbSerialPrintln("ButtonPlusPopCallBack");
memset(buffer, 0, sizeof(buffer));
LiftAngle.getText(buffer, sizeof(buffer));
number = atoi(buffer);
number += 1;
memset(buffer, 0, sizeof(buffer));
itoa(number, buffer, 10);
LiftAngle.setText(buffer);
}
/********************************************************************
Button Weiter Function
********************************************************************/
void ButtonWeiterPopCallBack(void *ptr)
{
dbSerialPrintln("ButtonWeiterPopCallBack");
Serial.print("page one");
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
}
/********************************************************************
Button Enter Function
********************************************************************/
void ButtonEnterPopCallBack(void *ptr)
{
int time_elapsed = (start_time - end_time)/1000;
float Rate = (count/time_elapsed*10)*24*3600; //Beat rate per day
float BeatError = (start_time - end_time)/10; //Divided by 10 because we using 10 beats
int lift_time = (start_time-end_time)/3*1000; //Divided by 3 becuase we want to calculate time between first and third tick
uint16_t lift_angle = number;
float Amplitude = lift_angle / (2 * sin(180 * lift_time * Rate / 7200));
float BeatRate = 36600; //per hour
float Frequency = BeatRate / 3600;
dbSerialPrintln("ButtonEnterPopCallBack");
Serial.print("page two");
Serial.print("Rate.txt=");
Serial.print(Rate);
Serial.print("Amplitude.txt=");
Serial.print(Amplitude);
Serial.print("BeatError.txt=");
Serial.print(BeatError);
Serial.print("BeatRate.txt=");
Serial.print(BeatRate);
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
}
/********************************************************************
Button Close Function
********************************************************************/
void ButtonClosePopCallBack(void *ptr)
{
dbSerialPrintln("ButtonClosePopCallBack");
Serial.print("page one");
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
}
void setup(void)
{
Serial.begin(9600); /* initialization of serial communication */
SPI.begin(); /* initialization of SPI port */
SPI.setDataMode(SPI_MODE0); /* configuration of SPI communication in mode 0 */
SPI.setClockDivider(SPI_CLOCK_DIV64); /* configuration of clock at 1MHz */
pinMode(SS, OUTPUT);
Serial.println("Start");
nexInit();
/********************************************************************
Register all event callback function of all component.
********************************************************************/
LiftAngle.PopCallBack(LiftAnglePopCallBack);
ButtonPlus.attachPop(ButtonPlusPopCallBack);
ButtonMinus.attachPop(ButtonMinusPopCallBack);
ButtonEnter.attachPop(ButtonEnterPopCallBack);
ButtonClose.attachPop(ButtonClosePopCallBack);
ButtonWeiter.attachPop(ButtonWeiterPopCallBack);
dbSerialPrintln("Setup done");
}
void loop(void)
{
nexLoop(nex_listen_list); /* When a pop or push event occured every time, the corresponding component[right page id and component id] in touch event list will be asked. */
int16_t* samples;
samples = (int16_t*)malloc(sizeof(int16_t)*100);
if(millis()>event)
{
if(samples == NULL)
{
Serial.print("insufficient memory");
}
else
{
float filteredval = f.filterIn(MIC3_getSound());
samples[n++] = filteredval;
}
}
if(*samples>18000)
{
count++;
start_time = millis();
if(count>=10)
{
end_time = millis();
}
}
/*int time_elapsed = (start_time - end_time)/1000;
float Rate = (count/time_elapsed*10)*24*3600; //Beat rate per day
float BeatError = (start_time - end_time)/10; //Divided by 10 because we using 10 beats
int lift_time = (start_time-end_time)/3*1000; //Divided by 3 becuase we want to calculate time between first and third tick
int lift_angle = 52;
float Amplitude = lift_angle / (2 * sin(180 * lift_time * Rate / 7200));
float BeatRate = 36600; //per hour
float Frequency = BeatRate / 3600;*/
Serial.println(*samples);
free(samples);
n = 0;
}
int MIC3_getSound(void) {
digitalWrite(SS, LOW); //activate chip select
int sound = SPI.transfer(0) | (SPI.transfer(0) << 8); //reconstruct 12-bit data
digitalWrite(SS, HIGH); //deactivate chip select
return sound;
}