Go to Post I would suggest spending a few more hours digesting the manual before you finalize your designs. You seem to have missed a few key rules. - GaryVoshol [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Spotlight this post!  
Unread 07-02-2007, 00:15
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,187
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: WPILib Op. Control mode

You will pretty much write your code the exact same way you would if you were using IFI's default code. Your control over the robots hardware is at a higher level in WPILib, so it will take some getting used to. At its most simple point, you will be calling functions to set motor values rather than assigning variables. At a more complicated point, you can write new device drivers to talk with sensors that aren't supported "out of the box".

If you want to watch for interrupts, you can use a cool feature of WPILib called an Interrupt Watcher. This is pretty simple.. You set up the interrupt watcher by giving it a port number. When the interrupt occurs, it sets a flag. In your main loop, you can check that flag. Pretty simple, pretty easy. This will come in handy if you have a sensor where you need to keep track of whether it was fired or not, and the operation of the sensor may be too fast for your main loop

From WPILib documentation:
Code:
// initialize interrupt watcher on port 1 looking for a rising edge 
//    this is an input going from low to high (like a switch opening) 
StartInterruptWatcher(1, RISING_EDGE); 
while (1) 
{ 
  
  // the time to poll the digital input port that was being watched 
  // 
  // 
  // check if the value has changed since the last check 
  if (GetInterruptWatcher(1) == 1) 
  { 
    printf("Interrupt Occurred!\r");
  } 
  // 
  // program doing more work over here. 
  // 
}
If you chose, you can also set up an ISR to handle these interrupts.

Take a look at the WPILib documentation. It is very well written and should help you out alot. Read the entire thing before you sit down to code.
http://users.wpi.edu/~bamiller/WPILib/WPILib.pdf
 


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
New version of WPILib BradAMiller Programming 26 27-01-2007 15:49
WPILib Questions Kruuzr Programming 1 22-01-2007 11:46
Auto aim in user control mode JamesBrown Programming 2 19-02-2006 12:58
Direct Control of PWMs and OI in WPILib CyberWolf_22 Programming 7 06-02-2006 19:06


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

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