Author |
Message |
ericsmalls
Moderator
Joined: Tue Dec 21, 2010 1:38 pm Posts: 24
|
 Project Help
How do you combine an if/else or while loop with sonar and motor synchronization? motor synchronization without an if/else or while loop and the sonar sensor work fine but when i combine the loop with the sonar senosr the motors are no longer synced and the sonar senor value is ignored :/ my code that works looks like this here's the one that doesnt work how i want it to Please Help.
|
Fri Dec 24, 2010 9:15 am |
|
 |
mightor
Site Admin
Joined: Wed Mar 05, 2008 8:14 am Posts: 3654 Location: Rotterdam, The Netherlands
|
 Re: Project Help
Hi Eric, Why don't you try this: - Xander
_________________| Professional Conduit of Reasonableness| (Title bestowed upon on the 8th day of November, 2013) | My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
Fri Dec 24, 2010 11:09 am |
|
 |
ericsmalls
Moderator
Joined: Tue Dec 21, 2010 1:38 pm Posts: 24
|
 Re: Project Help
i tweaked it a little; now it works perfect but when i use it in my primary program the bottom half of code doesnt work
do want me to post the code? it's pretty long.
|
Fri Dec 24, 2010 7:53 pm |
|
 |
mightor
Site Admin
Joined: Wed Mar 05, 2008 8:14 am Posts: 3654 Location: Rotterdam, The Netherlands
|
 Re: Project Help
Just attach the program as a whole, instead of pasting it into the message. Just like you would attach a file to a mail  - Xander
_________________| Professional Conduit of Reasonableness| (Title bestowed upon on the 8th day of November, 2013) | My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
Sat Dec 25, 2010 1:53 am |
|
 |
ericsmalls
Moderator
Joined: Tue Dec 21, 2010 1:38 pm Posts: 24
|
 Re: Project Help
I highlighted the parts I'm having problems with
|
Sat Dec 25, 2010 12:10 pm |
|
 |
mightor
Site Admin
Joined: Wed Mar 05, 2008 8:14 am Posts: 3654 Location: Rotterdam, The Netherlands
|
 Re: Project Help
Hi Eric, I've made quite a few changes to your program. The most important ones being the use of nSyncedTurnRatio. Read my comments in the code. Some pointers: - Use the motor and sensor setup to give your motors and sensors sensible names. I've renamed your motors MLEFT, MRIGHT and MSENSE.
- The most important thing you need to learn and be religious about is indentation!!! It took me a few minutes just to realign all the brackets. Indentation will make tracking down bugs so much easier. Get into the habit now, you'll thank me later.
- Xander
_________________| Professional Conduit of Reasonableness| (Title bestowed upon on the 8th day of November, 2013) | My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
Sun Dec 26, 2010 5:14 am |
|
 |
ericsmalls
Moderator
Joined: Tue Dec 21, 2010 1:38 pm Posts: 24
|
 Re: Project Help
Thank you for your help and i appreciate your advice.
Is it okay for me to post my project to the Cool project and get it on the website?
|
Mon Dec 27, 2010 12:06 pm |
|
 |
mightor
Site Admin
Joined: Wed Mar 05, 2008 8:14 am Posts: 3654 Location: Rotterdam, The Netherlands
|
 Re: Project Help
I see no reason why not  - Xander
_________________| Professional Conduit of Reasonableness| (Title bestowed upon on the 8th day of November, 2013) | My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
Mon Dec 27, 2010 12:23 pm |
|
 |
karan.hiremath
Rookie
Joined: Sun Jan 02, 2011 1:57 am Posts: 31
|
 Re: Project Help
hey cool project just one quick tip:
Ctrl+alt+shift+a+f is your friend: auto formats the whole file correctly indented and everything! saves hours of work...
_________________ Karan Hiremath FTC Team 110- MFS Foxes Co-Captain Head Programmer Builder Electrical Service Coordinator
|
Tue Jan 04, 2011 10:54 pm |
|
 |
mightor
Site Admin
Joined: Wed Mar 05, 2008 8:14 am Posts: 3654 Location: Rotterdam, The Netherlands
|
 Re: Project Help
You can also find that (and some other options) here:  - Xander
_________________| Professional Conduit of Reasonableness| (Title bestowed upon on the 8th day of November, 2013) | My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
Wed Jan 05, 2011 3:06 am |
|
|