(uncompiled, obviously)
char loopAction;
void setup()
{
... some stuff
... more stuff
}
void loop()
{
if (Serial.available()) {
{
loopAction = Serial.read();
}
if (loopAction == '1') {
someAction ();
}
if (loopAction == '2') {
someOtherAction ();
}
if (loopAction == '3') {
yetAnotherAction ();
}
}
Now you need to get rid of the delays, and if you're using the serial monitor, make sure "line-ending" is set to none.
TheMemberFormerlyKnownAsAWOL:
(uncompiled, obviously)
char loopAction;
void setup()
{
... some stuff
... more stuff
}
void loop()
{
if (Serial.available()) {
{
loopAction = Serial.read();
}
if (loopAction == '1') {
someAction ();
}
if (loopAction == '2') {
someOtherAction ();
}
if (loopAction == '3') {
yetAnotherAction ();
}
}
Now you need to get rid of the delays, and if you're using the serial monitor, make sure "line-ending" is set to none.
1.which delay??
2.and loopAction is just new varaiable in place of inChar