12.07.2015 Views

Handyboard and Kit Manual (A.K.A. - Botball Programming Guide)

Handyboard and Kit Manual (A.K.A. - Botball Programming Guide)

Handyboard and Kit Manual (A.K.A. - Botball Programming Guide)

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

© 2002 D.Miller, KIPR25IC: while ()• Syntax recap: while () {statements}void main(){int j=0; /* to tell how many times around the loop */while(stop_button()==0){j=j+1; /* next time around */printf(“loop %d - press stop to stop\n”,j);fd(0); /* turn on motor 0*/fd(2); /* turn on motor 2 */sleep(1.0); /* wait for 1 second */bk(0); bk(2); /* reverse both motors */sleep(1.0); /* wait for 1 second */}ao(); /* turn off all the motors */}© 2002 D.Miller, KIPR26Boolean Expressions• Boolean expressions result in either 1 (true) or 0(false)• Boolean operators:== (two equals signs together, not one)=!= (not equal)|| (or), && (<strong>and</strong>)! not• Already seen a boolean expression in while:– while ()13

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!