With something that will ask for input and then on switch statement (Or any other way) start the loop. So that I don't have to use a loop in C# to write to this one every 30 MS... Thanks!
With something that will ask for input and then on switch statement (Or any other way) start the loop. So that I don't have to use a loop in C# to write to this one every 30 MS... Thanks!
What?
If you want your task to be repetitive you must loop. Otherwise you don't have to loop. What is your project?
Falcuun:
Hey guys, I'm just wondering if there is any way I could replace:
With something that will ask for input and then on switch statement (Or any other way) start the loop. So that I don't have to use a loop in C# to write to this one every 30 MS... Thanks!
It makes no sense to start loop() after loop() is started. To delay starting loop() until an input arrives, wait for the input in the function that happens before loop(): setup()
void setup()
{
int command;
do
{
command = Serial.read();
}
while (command != '0' && command != '1');
switch (command)
{
case '1':
pin1();
pin2();
break;
case '0':
brightness = 0;
brightness2 = 0;
fade = 3;
fade2 = 10;
break;
}
}
void loop()
{
delay(30);
}