send serial only when active?

Nov 27, 2012 at 12:42pm

send serial only when active?

I posted on the Arduino forum:,134478.0.html

and to cover all the bases, I’m selfishly asking here too. I’m in the process of optimizing a Max/Arduino tool which features 18 FSRs and 18 LEDs, kind of a DIY QuNeo/Monome thing. My simple question is this: how can I ensure that the Arduino is sending serial data only when the sensors are active, >0., or changing. Is it simply a matter of:

if (myVar>0.){
//do nothing

I’ll go off and have a wee noodle with my code now anyway and see what happens,


Nov 27, 2012 at 2:15pm

yeah, that’s not gonna do it. It works, but unreliably, mainly as I’m using diy sensors.


how would I write a delta function in Arduino? Read sensor; read again, subtract current from previous; if delta >myThreshold then send, else flush and do nothing.

Said as much on the Duino forum too

Nov 27, 2012 at 2:44pm

Success, as follows IAI (my own new acronym: “if anyone’s interested”):

int currVal;
int prevVal;
int delta;

void loop(){

there’s other stuff going one, but not relevant to delta acquisition.

Once again, apologies for the [noise~]



You must be logged in to reply to this topic.