Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Revision 5:94b196231ecd, committed 2018-08-21
- Comitter:
- msimeone234
- Date:
- Tue Aug 21 01:04:17 2018 +0000
- Parent:
- 4:ab3a8a7a0fcf
- Commit message:
- now clean, with small motors included
Changed in this revision
motor.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r ab3a8a7a0fcf -r 94b196231ecd motor.cpp --- a/motor.cpp Mon Aug 20 09:12:05 2018 +0000 +++ b/motor.cpp Tue Aug 21 01:04:17 2018 +0000 @@ -100,29 +100,36 @@ void motorUp(){ int ch ,v; - for (v=0; v<10; v++){ // for each 1 unit of speed v - if (SValue < 0xFF) { // check if speed less than max + for (v=0; v<10; v++) // for each 1 unit of speed v (until 10) + { + if (SValue < 0xFF) // check if speed less than max + { SValue++; } - for(ch=1; ch<3; ch++){ // each big motor + for(ch=1; ch<3; ch++) // each big motor + { motorSpiSend(ch,SValue); // increase speed by 1 unit wait(0.01); // 2nd motor increases .01s after 1st motor } - for(ch=5; ch<9; ch++){ // each small motor + for(ch=5; ch<9; ch++)// each small motor + { motorSpiSend(ch,SValue); // increase speed by 1 unit wait(0.01); // 2nd motor increases .01s after 1st motor - + } } } void motorStop(){ int ch, v; - for (v=SValue; v>0; v--){ // for each 1 unit of speed v - for(ch=1; ch<3; ch++){ // each big motor + for (v=SValue; v>0; v--) // for each 1 unit of speed v + { + for(ch=1; ch<3; ch++) // each big motor + { motorSpiSend(ch,v); // decrease speed by 1 unit wait(0.01); // 2nd motor decreses .01s after 1st motor } - for(ch=5; ch<9; ch++){ // each small motor + for(ch=5; ch<9; ch++)// each small motor + { motorSpiSend(ch,v); // decrease speed by 1 unit wait(0.01); // 2nd motor decreses .01s after 1st motor }