here is my code that is giving me the error:
pgmcnt: 00017c
type: 2
Here is my teleop program.
Thanks for any help you can give.
code:
#pragma config(Hubs, S1, HTMotor, HTMotor, HTMotor, none)
#pragma config(Sensor, S2, IR_seeker, sensorHiTechnicIRSeeker1200)
#pragma config(Motor, motorB, motorB, tmotorNormal, PIDControl, encoder)
#pragma config(Motor, motorC, motorC, tmotorNormal, PIDControl, encoder)
#pragma config(Motor, mtr_S1_C1_1, intake_motor, tmotorNormal, openLoop, encoder)
#pragma config(Motor, mtr_S1_C1_2, lifter_motor, tmotorNormal, openLoop, encoder)
#pragma config(Motor, mtr_S1_C2_1, right_motor, tmotorNormal, openLoop, encoder)
#pragma config(Motor, mtr_S1_C2_2, left_motor, tmotorNormal, openLoop, reversed, encoder)
#pragma config(Motor, mtr_S1_C3_1, shooter_motor, tmotorNormal, openLoop, encoder)
#pragma config(Motor, mtr_S1_C3_2, shooter_motorII, tmotorNormal, openLoop, encoder)
// Tele-Operation Mode Code Template
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
/////////////////////////////////////////////////////////////////////////////////////////////////////
//
//
// This file contains a template for simplified creation of an tele-op program for an FTC
// competition.
//
// You need to customize two functions with code unique to your specific robot.
//
/////////////////////////////////////////////////////////////////////////////////////////////////////
#include "JoystickDriver.c" //Include file to "handle" the Bluetooth messages.
/*#define _LOGGING
#define NULL 0
typedef struct {
string name;
tMotor m;
int power;
} rmotor;
/////////////////////////////////////////////////////////////////////////////////////////////////////
// static struct init is not supported
// therefore these are inited below
rmotor intake;
rmotor lifter;
rmotor shooter;
rmotor shooterII;
rmotor wheelLeft;
rmotor wheelRight;
rmotor buttons[12];
int catline = 0;
void cat(string s)
{
// log text to nxt display
// each call advances to the next line
nxtDisplayTextLine(catline, s);
catline += 1;
catline %= 10;
}
void toggleMotor(rmotor *m)
{
// toggle motor on or off
#ifdef _LOGGING
string s = "tgl mtr:";
strcat(s, m->name);
strcat(s, ".");
cat(s);
#endif
if(m->power) {
motor[m->m] = 0;
} else {
motor[m->m] = 50;
}
m->power ^= true;
}
void onMotor(rmotor *m) {
motor[m->m] = 50;
}
void offMotor(rmotor *m) {
motor[m->m] = 0;
}*/
/////////////////////////////////////////////////////////////////////////////////////////////////////
void initializeRobot()
{
return;
}
/*void initializeRobot()
{
intake.name = "intake";
intake.m = intake_motor;
intake.power = 0;
lifter.name = "lifter";
lifter.m = lifter_motor;
lifter.power = 0;
shooter.name = "shooter";
shooter.m = shooter_motor;
shooter.power = 0;
shooterII.name = "shooterII";
shooterII.m = shooter_motorII;
shooterII.power = 0;
wheelLeft.name = "wheel_left";
wheelLeft.m = left_motor;
wheelLeft.power = 0;
wheelRight.name = "wheel_right";
wheelRight.m = right_motor;
wheelRight.power = 0;
for(int i=0; i<12; i++) buttons[i]=(rmotor)0;
buttons[0] = lifter;
buttons[1] = intake;
buttons[2] = shooter;
bFloatDuringInactiveMotorPWM = true;
cat("Start.");
nxtDisplayTextLine(4, "Start.");
return;
}*/
/////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Main Task
//
// The following is the main code for the tele-op robot operation. Customize as appropriate for
// your specific robot.
//
// Game controller / joystick information is sent periodically (about every 50 milliseconds) from
// the FMS (Field Management System) to the robot. Most tele-op programs will follow the following
// logic:
// 1. Loop forever repeating the following actions:
// 2. Get the latest game controller / joystick settings that have been received from the PC.
// 3. Perform appropriate actions based on the joystick + buttons settings. This is usually a
// simple action:
// * Joystick values are usually directly translated into power levels for a motor or
// position of a servo.
// * Buttons are usually used to start/stop a motor or cause a servo to move to a specific
// position.
// 4. Repeat the loop.
//
// Your program needs to continuously loop because you need to continuously respond to changes in
// the game controller settings.
//
// At the end of the tele-op period, the FMS will autonmatically abort (stop) execution of the program.
//
/////////////////////////////////////////////////////////////////////////////////////////////////////
task main()
{
initializeRobot(); //Initialize robot for tele-op mode
waitForStart();
//cat("Start.");
//nxtDisplayTextLine(4, "Start.");
while(true)
{
getJoystickSettings(joystick);
// nxtDisplayCenteredTextLine(3, "IR Val: %d", SensorValue(IRSensor));
if(joy1Btn(8))
{
motor[lifter_motor] = 50;
motor[intake_motor] = 50;
}
if(joy1Btn(3))
{
motor[shooter_motor] = 30;
motor[shooter_motorII] = 30;
}
if(joy1Btn(4))
{
aim_2();
}
else if(joy1Btn(2))
{
motor[shooter_motor] = 40;
motor[shooter_motorII] = 40;
}
else
{
motor[shooter_motor] = 0;
motor[shooter_motorII] = 0;
}
if(joy1Btn(7))
{
motor[lifter_motor] = 0;
motor[intake_motor] = 0;
}
if(joy1Btn(6))
{
motor[shooter_motor] = 0;
motor[shooter_motorII] = 0;
}
if(joy1Btn(5))
{
motor[shooter_motor] = 0;
motor[shooter_motorII] = 0;
}
/*
if(nPgmTime%10 == 1) {
if(joy1Btn(1)) toggleMotor(lifter);
if(joy1Btn(2)) toggleMotor(intake);
if(joy1Btn(3)) toggleMotor(shooter);
}
*/
// abort program
// if(joy1Btn(10)){ break; }
//panic button
if(joy1Btn(1))
{
motor[intake_motor] = 50;
motor[lifter_motor] = 50;
motor[shooter_motor] = 50;
}
if(joystick.joy1_TopHat == 2)
{
motor[intake_motor] = 100;
wait1Msec(50);
motor[intake_motor] = 0;
}
else if(joystick.joy1_TopHat == 6)
{
motor[intake_motor] = -50;
wait1Msec(50);
motor[intake_motor] = 0;
}
else if(joystick.joy1_TopHat == 0)
{
motor[shooter_motor] = 50;
wait1Msec(50);
motor[shooter_motor] = 0;
}
else if(joystick.joy1_TopHat == 4)
{
motor[shooter_motor] = -50;
wait1Msec(50);
motor[shooter_motor] = 0;
}
// control wheels
if(abs(joystick.joy1_y2) > 10){
motor[left_motor] = 5*joystick.joy1_y2;
} else {
motor[left_motor] = 0;
}
if(abs(joystick.joy1_y1) > 10){
motor[right_motor] = 5*joystick.joy1_y1;
} else {
motor[right_motor] = 0;
}
}
//cat("Aborted.");
//cat("Sleeping...");
//wait10Msec(100000);
}