Go to Post Things are not always as simple as they seem. - Paul Copioli [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 09-02-2005, 11:04
Jatheon4316's Avatar
Jatheon4316 Jatheon4316 is offline
Registered User
AKA: Jason
None #0500
Team Role: Programmer
 
Join Date: Jan 2005
Location: RI
Posts: 9
Jatheon4316 can only hope to improve
Send a message via AIM to Jatheon4316
Need some order in programming!

I've run into a bit of a pickle with my coding... When writing programs for stuff like joysticks etc, it's fine if the program runs every time the microprocessor refreshes(actually that's a good thing!). However, what if you don't want that to happen? An example in autonomous mode: you want to take a reference bearing with a digital compass at the beginning of the game. How do you prevent the robot from getting a new "first bearing" every time the processor loops? Or how about ordered events? If I want the robot to drive forward for a certain amount of time and then extend the arm, how do I prevent it from driving forward if it's already done so (when the processor refreshes)?

Is there some way to carefully control when pieces of code are carried out? Perhaps static integers or "do while" loops (Initialize integer an integer at 0. If you carry out the enclosed piece of code, mark the integer as a 1-so it won't repeat...)?

Help!
  #2   Spotlight this post!  
Unread 09-02-2005, 11:08
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: Need some order in programming!

Quote:
Originally Posted by Jatheon4316
I've run into a bit of a pickle with my coding... When writing programs for stuff like joysticks etc, it's fine if the program runs every time the microprocessor refreshes(actually that's a good thing!). However, what if you don't want that to happen? An example in autonomous mode: you want to take a reference bearing with a digital compass at the beginning of the game. How do you prevent the robot from getting a new "first bearing" every time the processor loops? Or how about ordered events? If I want the robot to drive forward for a certain amount of time and then extend the arm, how do I prevent it from driving forward if it's already done so (when the processor refreshes)?

Is there some way to carefully control when pieces of code are carried out? Perhaps static integers or "do while" loops (Initialize integer an integer at 0. If you carry out the enclosed piece of code, mark the integer as a 1-so it won't repeat...)?

Help!
Do a search on "state machine" and "state variable" for your answer.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming - Getting Started Mark McLeod Programming 80 16-04-2008 23:37
Organizing a programming team. scitobor 617 Programming 7 28-01-2005 19:18
Programming Code themaxim Programming 10 07-01-2005 13:07
Robot Programming Education phrontist Programming 11 03-05-2004 07:32
Using an Operator Interface with the 2004 EDU RC wirelessly Dave Flowerday Robotics Education and Curriculum 34 19-04-2004 19:06


All times are GMT -5. The time now is 19:19.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi