View unanswered posts | View active topics It is currently Wed Jan 18, 2017 10:23 pm

Reply to topic  [ 2 posts ] 
this program chrashes immediatly after starting help 
Author Message

Joined: Wed Oct 22, 2008 3:32 pm
Posts: 7
Post this program chrashes immediatly after starting help
it almost instantly freezes the computer and the nxt and after a few seconds bluescreens

please help me
#pragma config(Hubs,  S1, HTMotor,  HTServo,  HTMotor,  none)
#pragma config(Motor,  motorA,          ,              tmotorNormal, PIDControl, )
#pragma config(Motor,  motorB,          ,              tmotorNormal, PIDControl, )
#pragma config(Motor,  motorD,          leftMotor,     tmotorNormal, openLoop, )
#pragma config(Motor,  motorE,          rightMotor,    tmotorNormal, openLoop, reversed)
#pragma config(Servo,  servo1,          eServoleft,           tServoNormal)
#pragma config(Servo,  servo2,          eServoright,          tServoNormal)
#pragma config(Servo,  servo3,          bServoleft,           tServoNormal)
#pragma config(Servo,  servo4,          bServoright,          tServoNormal)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

/*//you should replace all of what we already have with this but just comment it out we might still need it
#pragma config(Hubs,  S1, HTMotor,  HTServo,  HTMotor,  none)

#pragma config(Motor,  mtr_S1_C1_1,     leftMotor,        tmotorNormal, openLoop,)
#pragma config(Motor,  mtr_S1_C1_2,     rightMotor,        tmotorNormal, openLoop,)
#pragma config(Motor,  mtr_S1_C3_2,     basMo,     tmotorNormal, openLoop,)
#pragma config(motor,  mtr_S1_C3_1
#pragma config(Servo,  servo1,          armServo,             tServoNorma)
#pragma config(Servo,  servo2,          elbowServo,             tServoNormal)

//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*/ //you might need to redo this^
//you will need to figure out the stuff for the autonomous, sorry
#include "JoystickDriver.c"

void endServoControler();
void motorControl();
void elbowControl();
//void autonomousMode();

task main()
   while (true)
      while (true)
         while (/*joystick.UserMode =*/ true) // look it up in help it should tell you exactly what variable to use
           elbowControl(); //the one at the "elbow" of the robot
      /*while (joystick.UserMode = false)
         autonomousMode(); // you might need to put a getJoystickSettings(joystick) or something before this, check

void elbowControl()//motorBotor at the base that swings it up or down
   int basePower = 0;

   if (joy1Btn(2))
      basePower = basePower - 75;  // make tower go one way; up i think

   if (joy1Btn(3))
      basePower = basePower + 75;  // Make tower go the other way; down i think

   // pressing both 2 & 3 is the same as pressing none at all

   motor[motorA] = basePower;
   motor[motorB] = basePower;

void motorControl()
   motor[leftMotor] = joystick.joy1_y1;
   motor[rightMotor] = joystick.joy1_y2;

void endServoControler() //servo that does the dumping
    if (joy1Btn(1) !=0 && joy1Btn(4) != 0)
      if (joy1Btn(1) != 0)
         servoTarget[eServoright] = 255;
         servoTarget[eServoleft] = 0;
      if (joy1Btn(4) != 0)
         servoTarget[eServoright] = 0;
         servoTarget[eServoleft] = 255;

/*void autonomousMode()
  motor[leftMotor] = 100;
  motor[rightMotor] = -100;

Wed Feb 25, 2009 5:01 pm
User avatar

Joined: Tue Oct 14, 2008 7:16 pm
Posts: 171
Location: Investigating an unidentified ship sighted in Sector 31428
Post Re: this program chrashes immediatly after starting help
Start by eliminating one of the while loops from your main task. You have two nested while loops; this is completely unnecessary and could be contributing to your problems. Also be sure to comment out the second set of #pragma statements, this, although I'm not sure why it even let you compile, could be causing conflicting hardware assignments.

Captain, Head programmer, School of the Arts, Silverbots Robtics Team #2890
using namespace System;
using namespace Genius;
using namespace Personality;
public ref class Nerd : Geek, IAnserable
    Geek::Type brainMode = Geek::Type::Programmer;

Wed Feb 25, 2009 5:56 pm
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.