Start a new topic

Arduino sensor input into waveform

I am connecting an Arduino mega 2560 to a single axis accelerometer for vibrations, and I wanted to output the sensor value on the waveform option of the nextion.
I changed the sensor value into a 0 to 255 scale int values, but I tried different approaches to send the values from the arduino to the nextion display, and I can't yet figure out what is the best way to do this or if it is possible.
1 Comment

Assuming nexSerial is configured to Serial2 in Iteadlib Arduino Nextion Library


// declared NexComponent  localname = NexComponent(pagenumber,componentid,.objname); 

NexWaveform wave1 = NexWaveform(0,1,"s0");


// ch channel 0 to 3, as per number of channels in HMI designed waveforn

// value in 0 to 255

wave1.addValue(ch,value);


Without such a library send over serial

  add 1,0,23ÿÿÿ

See add command in Nextion Instruction Set.

  where 1 is component id, 0 is channel, 23 is value


So indeed possible to send values to a waveform.

Waveform is a local component, page must be current page

- changing page away from and back will clear data.



Login or Signup to post a comment