void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
}
void getOdd(int inp){
for(int i = 0; i <= inp; i++){
if(i%2 != 0){
Serial.print("ODD: ");
Serial.println(i);
}
}
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
char inpChar;
static String inp = "";
int inpInt;
if(Serial.available() > 0){
inpChar = Serial.read();
if(inpChar == '\n'){
inpInt = inp.toInt();
Serial.print("Recieved: ");
Serial.println(inpInt);
getOdd(inpInt);
inp = "";
}else{
inp += inpChar;
}
}
}