View Single Post
  #2   Spotlight this post!  
Unread 29-01-2009, 09:26
alaa abo alheja's Avatar
alaa abo alheja alaa abo alheja is offline
Registered User
FRC #1946 (Mishka Monsters)
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Israel
Posts: 9
alaa abo alheja is an unknown quantity at this point
Send a message via MSN to alaa abo alheja
Re: can anyone help me to get gyro c++ code?

here i have the c code of the gyro sensor, can anyone help me to make it work with 4 mottors?

Code:
float get_angular_velocity(){
    float omega_rad_per_sec, omega_deg_per_sec, u;
    u = (float) SensorRaw[S1];                   // sensor port 1 is used for CRS03-02
    omega_deg_per_sec =(u/1023*5 - 2.5)/0.02;    // angular velocity(deg/s)
    omega_rad_per_sec =omega_deg_per_sec/180*PI; // angular velocity(rad/s)
    return(omega_rad_per_sec);
}
 
task main()
{
    float omega;
    motor[motorA] = 100;    // power supply for voltage regulator 
    while(1){
        omega =get_angular_velocity();
    }
}
plz all who can help give their help to me.
thank u for all
Reply With Quote