Motor control with 7" & some NOOB questions

Hello All,

I have a project that I require some help with.

I have a dashboard that I will be using as input to locate two linear actuators.

When I click the Width button (bWidth) t1 begins to blink with a cursor.

If I then click on the Height button (bHeight) the cursor in t1 stops and a cursor begins to blink in the t2.

All that is working fine. My two questions are:

  • When I start inputting #’s, how do I tell them to populate the textbox that has the focus (blinking cursor)?
  • Also, some help with moving the first pressed # into the tens column when a second # is pressed.

I am fairly competent on the Arduino side, but I’m a total NOOB with the Nextion display. This seems like a great forum, and I am grateful for what I’ve learned so far and I’m very appreciative of any help you can give me.

TIA,

Muggs

BTW,
putting:

if(tmW.en==0==tmH.en==0)
{
  t1.txt=""
}else if tmW.en1
{
  t1.txt="0"
}else
{
  t2.txt="0"
}

in the Touch Release Event of the “0” button doesn’t work.

You’ll need a variable to store which entry field, Width or Height, is active.

// Note: vaTxtLength.val limits the number of characters which
// can be entered.  In my project, this can vary.

// Button 1 Touch Release Event
strlen t0.txt,vaCurLength.val
if(vaCurLength.val<vaTxtLength.val)
{
  t0.txt=t0.txt+"1"
}

// Button 4 Touch Release Event
strlen t0.txt,vaCurLength.val
if(vaCurLength.val<vaTxtLength.val)
{
  t0.txt=t0.txt+"4"
}

// Text box Touch Release Event.  This deletes last digit entered
t0.txt=t0.txt-1

// OK button Touch Release Event
// Many if statements to write the entry back to the calling page/control.
// Some convert to numbers
if(va0.val==12)// Move: X-1 Count (Each page/control has an ID)
{
  cov t0.txt,pageMove.n0.val,0
  pageMove.vaCount_X1.val=pageMove.n0.val
  delay=100
  page pageMove
}

// Some store the text in EEPROM and send it to the MCU.
if(va0.val==224)// Rose:X Axial Amplitude 
{
  pageRose.vaXAmp.txt=t0.txt
  pageRose.t6.txt=t0.txt
  wepo pageRose.t6.txt,264 //Store value in EEPROM at 224-231
  print "ã" // Ascii:227
  print t0.txt
  printh FF // Custom serial end code
  delay=100
  page pageRose // Return to calling page
}

Full code for Nextion is here: https://github.com/elfren/RoseEngine_SpindleAndAxis/tree/master/Nextion

NumberPad

elf,

Sorry for the late reply. Thank you, this will be very helpful.