thijs ruikes
/
PROJECT-BATJEPOSTITIE
vor bas
Revision 2:2b64e8a0a075, committed 2014-10-31
- Comitter:
- wiesdat
- Date:
- Fri Oct 31 10:27:11 2014 +0000
- Parent:
- 1:d157905a98d1
- Commit message:
- ding
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r d157905a98d1 -r 2b64e8a0a075 main.cpp --- a/main.cpp Fri Oct 31 10:15:16 2014 +0000 +++ b/main.cpp Fri Oct 31 10:27:11 2014 +0000 @@ -20,34 +20,35 @@ float out_i = 0; int y; -void batposition(int y) + +int main() { + while(1){ + cout<<"typ 1 voor links, 2 voor rechts: "<<endl; + cin>>y; switch(y) { case 1: cout<<"links"<<endl; - dir.write(1); + dir = 1; pwm.write(0.4); - wait(0.03); + wait(0.01); pwm.write(0); break; case 2: cout<<"rechts"<<endl; - dir.write(0); + dir = 0; pwm.write(0.4); - wait(0.03); + wait(0.01); pwm.write(0); break; - + case 3: + cout<<encoderA.getPosition()<<endl; + break; + case 4: + encoderA.setPosition(0); + break; } - } -int main() -{ - while(1) { - cout<<"typ 1 voor links, 2 voor rechts: "<<endl; - cin>>y; - batposition(y); - } } \ No newline at end of file