View Single Post
  #2   Spotlight this post!  
Unread 02-07-2007, 00:52
EHaskins EHaskins is offline
Needs to change his user title.
AKA: Eric Haskins
no team (CARD #6 (SCOE))
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Elkhorn, WI USA
Posts: 998
EHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond repute
Send a message via MSN to EHaskins
Re: Too many R/C commands in a loop?

1) The second four commands are overriding the first four.

I wrote this code from memory, so if it isn't perfect don't yell at me.
Code:
#include "Main.h"

void main ( void )
{
      int x; 
      int y; 
      int r; 
      int nw; 
      int ne; 
      int sw; 
      int se; 

      //Get inputs
      x = GetRxInput ( 1 , 1 ) ;
      y = GetRxInput ( 1 , 2 ) ;
      r = GetRxInput ( 1 , 3 ) ;

      // convert the inputs so 0 is neutral.
      x -= 127 ;
      y -= 127 ;
      r -= 127 ;

      // compute outputs
      nw = x + y - r ;
      se = x + y + r ;
      ne = x - y - r ;
      sw = x - y + r ;

      //Set outputs
      SetPWM ( 1 , nw + 127 ) ;
      SetPWM ( 2 , ne + 127 ) ;
      SetPWM ( 3 , sw + 127 ) ;
      SetPWM ( 4 , se + 127 ) ;
}
You should also add code so that you don't try to send the motors values less than 0 or over 255.
2) This is how you get text from EasyC.

a. Select the Project tab under the list of functions.
b. Right click on the function you want to get text from, and click Open C file.
c. Highlight the code, right click, select Copy OR Ctrl+C.

NOTE: You should post programming questions in the programming section of the forum, even if your questions are Vex specific.
__________________
Eric Haskins KC9JVH
Reply With Quote