do...while exiting when it shouldn't?
i think loop exiting when shouldn't...here's code...
it's part of it...as far i'm aware, should keep getting total1 , total2 values, based on conditions exit loop "input valid" stage if contact_new different contact_old.
but without changing on pins in question, processes "input valid" command, when both contact_old , contact_new zero.
what doing wrong? if need code let me know, though i'll have edit some...
code: [select]
int contact_new = 0;
int contact_old = 0;
int changepoint = 0;
int livelog = 0; //(set 0 contact change log)
int rval = random(50,255);
int gval = random(50,255);
int bval = random(50,255);
int p=0; //pixel number;
float start = millis();
long total1;
long total2;
do {
do {
total1 = cs_4_2.capacitivesensor(1);
total2 = cs_4_6.capacitivesensor(1);
if ((total1 < 15) && (total2 < 15)) contact_new = 0;
if ((total1 > 15) && (total2 < 15)) contact_new = 1;
if ((total1 < 15) && (total2 > 15)) contact_new = 2;
if ((total1 > 15) && (total2 > 15)) contact_new = 3;
serial.print ("no change");
serial.print ("\t");
serial.print (contact_new);
serial.print ("\t");
serial.println (contact_old);
delay(500);
}while (contact_new = contact_old);
serial.print ("input valid, processing");
serial.print ("\t");
serial.print (contact_new);
serial.print ("\t");
serial.println (contact_old);
delay(1000);
it's part of it...as far i'm aware, should keep getting total1 , total2 values, based on conditions exit loop "input valid" stage if contact_new different contact_old.
but without changing on pins in question, processes "input valid" command, when both contact_old , contact_new zero.
what doing wrong? if need code let me know, though i'll have edit some...
code: [select]
float start = millis();
why? millis() not return float.
quote
what doing wrong?1) not posting of code.
2) not posting serial data.
3) not printing enough data. proof inner do/while loop being exited prematurely useful.
Arduino Forum > Using Arduino > Programming Questions > do...while exiting when it shouldn't?
arduino
Comments
Post a Comment