Hello Guest it is March 28, 2024, 06:14:19 AM

Author Topic: Lua  (Read 15282 times)

0 Members and 1 Guest are viewing this topic.

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: Lua
« Reply #50 on: January 24, 2017, 04:38:08 PM »
The way it works with the plugin ive been writing for what seems an age is it does the filtering before it sends, in the video i posted you will notice that the tx light only goes on when I move the pot. this is done in a simple form of

Code: [Select]
  pot = analogRead(potPin);

  if (potb > pot + 2 || potb < pot - 2)
  {
    Serial.Send(pot)
    potb = pot;
    delay(50);
  }

so any fluctuations from the pot etc get ignored.

This can be done with lua also in an IF statement in the plc to compare the new value with the last value and if its greater than or less than a certain percentage then set spindle to new value.

DazTheGas
New For 2022 - Instagram: dazthegas

Offline CRS

*
  •  61 61
    • View Profile
Re: Lua
« Reply #51 on: January 25, 2017, 04:26:47 AM »
Hi DazTheGas, the PoKeys does have a filtering facility.  The down side is the reaction time of the override slider becomes a bit sluggish.  But the fluctuations are a lot better.  Even when I run the 180VDC spindle, it's not bad.  I think good enough to leave for now.

But having said that, I just had to try your table idea again.

Redid the numbers so the left column went from 0 to 1 in 0.01 increments.  The right column stayed the same 0.5 to 1.5. All looked good and no errors.  But I really am just playing Tattslotto and hoping for the best.  Wasn't sure how to reword the rounding factor.  So I just replaced 10 with 0.01.  Hmm that didn't do it.  I will keep playing with that, but for now, slider still glued to the bottom.

What you said about filtering before it sends makes sense when I read it, but remember you are talking to a Lua illiterate, so I think time to move on to the next thing.  I'm sure you'll be hearing from me.

Thanks Daz, have another biccy on me.

Craig