I am new to the world of arduino. My project requires me to use motor for some application. So I am using SG90 servo and I am able to sweep the servo from 0 deg to 180 deg using the sweep code given in the examples. I made small change to the original code which is highlighted below:
So as you can see I have added a serial communication just to see if I can receive any messages while the servo is turning. So once the servo starts to rotate I open the "Serial monitor" but I see few "Hello1" s and thats it and I dont get any more "Hello"s.
Can somebody let me know what mistake I am making as it is very crucial for my project?
So after the first run through the loop and pos is incremented to 179 , since 179 is greater than 1, why wouldn't it drop out of the
loop when it gets to this ?
for(pos=179;pos>=1;pos--)
Isn't
pos>=1
the condition to exit the loop ? (and isn't this condition met when pos=179 ?)
What am I missing here ?
OK, let's imagine for a moment that there's a variable called "po" and that you assign it the value zero.
What do you think that will do to your for loop?
I have no idea where all the BS about insults came from.
I suggest you print out a message in setup() so it is obvious when the Arduino has reset. For example, this line will print out a line of text telling you what sketch is running: