Boolean question
is have code reads code serial port (pc). using boolean want able enable/disable printing of read input pc (it should disabled default)
on top of sketch i've declared:
after reading serial code (the code has include following header , footer) input saved inside array (stringin):
header: ~
footer: #
based on command printing function enabled or disabled:
but gamepadserialfeedback variable not changed , keeps value declared ont top of sketch?
is not possible change state/value of variable @ runtime?
thanks in advance,
cheers /me
on top of sketch i've declared:
code: [select]
//gamepadserialfeedback variables declaration
boolean gamepadserialfeedback = false;
const char serialfeedbackon[] = "~serialfeedbackon#";
const char serialfeedbackoff[] = "~serialfeedbackoff#";
after reading serial code (the code has include following header , footer) input saved inside array (stringin):
header: ~
footer: #
based on command printing function enabled or disabled:
code: [select]
//enables or disables feedback (print) arduino interface software.
if (strcmp(serialfeedbackoff,stringin) == 0){
serial.print("~gamepadserialfeedbackoff#");
gamepadserialfeedback = false;
}
else if (strcmp(serialfeedbackon,stringin) == 0){
serial.print("~gamepadserialfeedbackon#");
gamepadserialfeedback = true;
}
if (gamepadserialfeedback == true){
// print array. debugging code
for(int j=0; j < (i-1) ; j++){
serial.print(stringin[j]);
}
}
but gamepadserialfeedback variable not changed , keeps value declared ont top of sketch?
is not possible change state/value of variable @ runtime?
thanks in advance,
cheers /me
the more problem not populating stringin array correctly, neither strcmp function returning match occurred.
we'd need see more of code, , output sketch.
we'd need see more of code, , output sketch.
Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Boolean question
arduino
Comments
Post a Comment