We have fixed a ball for our robot. It is pretty big, so now we are thinking about launching mechanism for it.
Sunday, March 16, 2014
Thursday, February 27, 2014
Sunday, February 23, 2014
Tuesday, December 17, 2013
Do while loop
This loop quiet similar to While loop, but here firstly it does action and then check condition.
Synatx:
do
{
//code
} while(condition);
Example:
int i=15;
do
{
i=i-5;
} while(i!=0);
This code will substract '5' from i until it is not equals to '0'.
Synatx:
do
{
//code
} while(condition);
Example:
int i=15;
do
{
i=i-5;
} while(i!=0);
This code will substract '5' from i until it is not equals to '0'.
While loop
This loop will repeat action until it is true.
Syntax:
while(condition)
{
//code
}
Example:
int i=10;
while(i > 0)
{
i=i-1;
}
This loop will continue substracting '1' from i, until i > 10.
Syntax:
while(condition)
{
//code
}
Example:
int i=10;
while(i > 0)
{
i=i-1;
}
This loop will continue substracting '1' from i, until i > 10.
For loops and Arduinod
We need loops to repeat one action multiple times.
Syntax:
for(variable, which we will change; condition; change variable)
{
//code to repeat
}
Example:
int a=0;
for(int i=0; i<10; i++)
{
a=a+1;
}
This code will add to a '1' 10 times, so at the end of our loop a will be equal '10'.
Syntax:
for(variable, which we will change; condition; change variable)
{
//code to repeat
}
Example:
int a=0;
for(int i=0; i<10; i++)
{
a=a+1;
}
This code will add to a '1' 10 times, so at the end of our loop a will be equal '10'.
Subscribe to:
Posts (Atom)





