|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
ROBOTC help
Hey. I'm having trouble programing a ROBOTC code into the RC. I keep getting this error:
Robot controller failed to respond Possibly not powered on or corrupted firmware Or low battery connection or cable connections between controller and PC are wrong Or incorrect port is selected on PC Or FRC controller is not connected via tether or radio -I checked every single one of these things and nothing fixes this error. Heres the code I am using-- Code:
#include "FRC_Comp_Include.c"
void Initialization()
{
bMotorReflected[port2] = true;
}
task Autonomous()
{
motor[port1] = 30;
motor[port2] = 30;
wait1Msec(500);
motor[port1] = 0;
motor[port2] = 0;
}
task Human_Control()
{
while(true)
{
motor[port1] = frcRF[p1_y];
motor[port2] = frcRF[p2_y];
}
}
Code:
void Initialization();
task Autonomous();
task Human_Control();
task main()
{
bool bCurrentPhase;
//
// Run the user initialization function
//
Initialization();
bCurrentPhase = !bIfiAutonomousPhase; // This will ensure that task will be started first time through
//
// Loop forever checking to see if the phase has changed
//
while (true)
{
//
// Need to check whether the phase has switched. We only want to do action when a change has occurred.
// This is because the "StartTask" function will either start a task running or restart an existing running task!
//
if (bCurrentPhase != bIfiAutonomousPhase)
{
//
// Need to switch phases
//
// 1. Always stop the current task first
// 2. Then start the new task.
//
// If you start the "new" task before stopping the current task, then for a brief time you may have both tasks
// running simultaneously.
//
bCurrentPhase = bIfiAutonomousPhase;
if (bCurrentPhase)
{
StopTask(Human_Control);
StartTask(Autonomous);
}
else
{
StopTask(Autonomous);
StartTask(Human_Control);
}
}
// Delay a little so this task minimizes it's CPU execution time. Otherwise it will take 50% of the CPU time and
// slow down the "Autonomous" or "Human_Control" tasks which are doing the "real" time.
wait1Msec(20);
}
}
|
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Free ROBOTC for all 2008 FIRST Robotics Teams! | Brandon Martus | Announcements | 12 | 01-02-2008 11:22 |
| Setting up an analog input in RobotC for IFI. | NSolarz | Programming | 2 | 30-01-2008 20:23 |
| ROBOTC - Controller | ShawnHanna | Programming | 1 | 30-01-2008 20:20 |
| Free ROBOTC for all 2008 FIRST Robotics Teams! | timville | Programming | 0 | 09-01-2008 10:27 |
| Congrats to the Robotc Knights! | MattB703 | Thanks and/or Congrats | 0 | 18-03-2002 15:07 |