A
Arduino•2mo ago
TheStudier

Give me a mini coding problem involving while loops.

Im a beginner and wanna learn while loops better. thanks
6 Replies
DarwinWasWrong
DarwinWasWrong•2mo ago
print out - on serial a list of numbers ranging from 0 to 300 jumping 10 each time eg
0,10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200,210,220,230,240,250,260,270,280,290,300
0,10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200,210,220,230,240,250,260,270,280,290,300
Hmmm 😶 yeah editted I was trying to think of other things too.
TheStudier
TheStudierOP•2mo ago
int counter = 0; int delay2 = 200; void setup(){ Serial.begin(9600);
} void loop() { while(counter<=300) { Serial.println(counter); delay(delay2); counter=counter + 10; } } I got it from 10 to 300 im not sure how to make it from 0 to 300 also I used for loops to do the same thing and it was a lot easier for me. Should I just use for loops more? what the is that I wonder
DarwinWasWrong
DarwinWasWrong•2mo ago
@TheStudier Wokwi - a simulator for arduino allowing you to test code etc and show others. A basic search of the term wokwi would have told you that
AnonEngineering
AnonEngineering•2mo ago
i think OP was referring to application.cpp or the Fibonacci-like sequence
DarwinWasWrong
DarwinWasWrong•2mo ago
Ok - so here I sit broken hearted... šŸ˜†
TheStudier
TheStudierOP•2mo ago
thanks guys

Did you find this page helpful?