Start a new topic

Waveform x Scale

 Hello guys,


I am a newby about Arduino and Nextion an I hope someone can help me.

I have an Arduino Mega 2560 connected to a Nextion 7" Enhanced by RX and TX.

There are 3 analog ECG Signal inputs which can shown on three waveforms on the nextion display.


On the third waveform there are some negative peaks which are wrong. I dont know why but on the serial plotter it shows correctly (see attachment).


Is there a way to change the X Scale to expand the graphs?


And is there a way for a "static" Graph like a usual ECG graph?


Thanks in advance. 



Here the Arduino scetch:


#include <doxygen.h>
#include <NexButton.h>
#include <NexCheckbox.h>
#include <NexConfig.h>
#include <NexCrop.h>
#include <NexDualStateButton.h>
#include <NexGauge.h>
#include <NexGpio.h>
#include <NexHardware.h>
#include <NexHotspot.h>
#include <NexNumber.h>
#include <NexObject.h>
#include <NexPage.h>
#include <NexPicture.h>
#include <NexProgressBar.h>
#include <NexRadio.h>
#include <NexRtc.h>
#include <NexScrolltext.h>
#include <NexSlider.h>
#include <NexText.h>
#include <NexTimer.h>
#include <Nextion.h>
#include <NexTouch.h>
#include <NexUpload.h>
#include <NexVariable.h>
#include <NexWaveform.h>

#include <SPI.h>

int var1 = analogRead(0);
int var2 = analogRead(1);
int var3 = analogRead(2);

NexWaveform s0 = NexWaveform(1, 1, "s0");
NexWaveform s1 = NexWaveform(1, 3, "s1");
NexWaveform s2 = NexWaveform(1, 4, "s2");

static uint8_t ch0_data = analogRead(0);
static uint8_t ch1_data = analogRead(1);
static uint8_t ch2_data = analogRead(2);

void setup() {

 nexInit();
   Serial.begin(9600);
   b1.attachPop(b1PopCallback, &b1);
 
    dbSerialPrintln("setup done");
   
}

void loop() {

  int var1 = analogRead(0);
  int var2 = analogRead(1);
  int var3 = analogRead(2);

 Serial.println(var3);
 
 static uint32_t started = 0;
 
s0.addValue(0, var1);
s1.addValue(0, var2);
s2.addValue(0, var3);

DSC0243.JPG
(4.47 MB)

1 person likes this idea
1 Comment

Use forum at nextion.itead.cc - this one closed Nov 15, 2017