NXT Help
-
- Posts: 2
- Joined: 03 May 2013, 12:05
NXT Help
alright guys i need a little help. for an assignment for college ive got to program an NXT to move and react with 2 sensors. now normally that would be fine but the software they use is rubbish and causes the code to clash with each other half the time and crash the other. if i try do it in raw code it never works. if anyone can help me make the robot just move forward until it either gets a signal from the touch sensor or gets a signal from the sound sensor it will turn 90 degress to either the left or right then i would be eternally grateful. Everytime i try and do it, it never works so if someone could just make a quick coding of it and copy and paste it on here i will be very grateful to you.
-
- Posts: 346
- Joined: 27 Sep 2010, 03:05
- Contact:
Re: NXT Help
1) What software are they using?moltendaniel wrote:alright guys i need a little help. for an assignment for college ive got to program an NXT to move and react with 2 sensors. now normally that would be fine but the software they use is rubbish and causes the code to clash with each other half the time and crash the other. if i try do it in raw code it never works. if anyone can help me make the robot just move forward until it either gets a signal from the touch sensor or gets a signal from the sound sensor it will turn 90 degress to either the left or right then i would be eternally grateful. Everytime i try and do it, it never works so if someone could just make a quick coding of it and copy and paste it on here i will be very grateful to you.
2) What software do you want to use?
Steve
---> Link to lots of MINDSTORMS stuff under my picture --->
-
- Posts: 2
- Joined: 03 May 2013, 12:05
Re: NXT Help
im using bricxcc for the raw coding. i cant remember the drag and drop software the college provides but it is rubbish and never works so thats why im using the bricxcc software. if you can provide some code examples on making the sound sensor work and the touch sensor so i can make them work together i would be very grateful. thank youhassenplug wrote:1) What software are they using?moltendaniel wrote:alright guys i need a little help. for an assignment for college ive got to program an NXT to move and react with 2 sensors. now normally that would be fine but the software they use is rubbish and causes the code to clash with each other half the time and crash the other. if i try do it in raw code it never works. if anyone can help me make the robot just move forward until it either gets a signal from the touch sensor or gets a signal from the sound sensor it will turn 90 degress to either the left or right then i would be eternally grateful. Everytime i try and do it, it never works so if someone could just make a quick coding of it and copy and paste it on here i will be very grateful to you.
2) What software do you want to use?
Steve
Re: NXT Help
A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.
NXT software ??
Hi there, I want to write a program in robotc NXT that will make the robot to move above a black strip and when it find a white object it remove it from is way and when it finds a black object it by pass it and return back to the black track......help!!. This is my first attempt to write an NXT robot code and this what i have right now.
#pragma config(Sensor, S4, sonarSensor, sensorSONAR)
#pragma config(Sensor, S1, colorPort, sensorCOLORFULL)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task main()
{
string sColor;
int distance_in_cm = 20; // Create variable 'distance_in_cm' and initialize it to 20(cm).
while(1)
{
if(SensorValue[sonarSensor] > distance_in_cm) // While the Sonar Sensor readings are less than the specified, 'distance_in_cm':
{
motor[motorB] = 20;
motor[motorC] = 20;
}
else if (SensorValue[sonarSensor] < distance_in_cm)
{
switch (SensorValue[colorPort])
{
case BLACKCOLOR: sColor = "Black";
motor[motorC] = -10; // Motor C is run at a 75 power level.
motor[motorB] = -10;
wait1Msec(1000);
motor[motorC] = 360; // Motor C is run at a 75 power level.
motor[motorB] = -360;
break;
case WHITECOLOR: sColor = "White";
motor[motorA] = 1;
wait1Msec(100);
motor[motorB] = 0;
motor[motorC] = 0;
wait1Msec(1000);
motor[motorA] = -10;
wait1Msec(100);
motor[motorA] = 10;
wait1Msec(100);
break;
default: sColor = "???";
motor[motorB] = 0;
motor[motorC] = 90;
wait1Msec(100000);
break;
}
nxtDisplayCenteredTextLine(2, sColor);
wait1Msec(50);
}
}
}
I appreciate your time and help
#pragma config(Sensor, S4, sonarSensor, sensorSONAR)
#pragma config(Sensor, S1, colorPort, sensorCOLORFULL)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task main()
{
string sColor;
int distance_in_cm = 20; // Create variable 'distance_in_cm' and initialize it to 20(cm).
while(1)
{
if(SensorValue[sonarSensor] > distance_in_cm) // While the Sonar Sensor readings are less than the specified, 'distance_in_cm':
{
motor[motorB] = 20;
motor[motorC] = 20;
}
else if (SensorValue[sonarSensor] < distance_in_cm)
{
switch (SensorValue[colorPort])
{
case BLACKCOLOR: sColor = "Black";
motor[motorC] = -10; // Motor C is run at a 75 power level.
motor[motorB] = -10;
wait1Msec(1000);
motor[motorC] = 360; // Motor C is run at a 75 power level.
motor[motorB] = -360;
break;
case WHITECOLOR: sColor = "White";
motor[motorA] = 1;
wait1Msec(100);
motor[motorB] = 0;
motor[motorC] = 0;
wait1Msec(1000);
motor[motorA] = -10;
wait1Msec(100);
motor[motorA] = 10;
wait1Msec(100);
break;
default: sColor = "???";
motor[motorB] = 0;
motor[motorC] = 90;
wait1Msec(100000);
break;
}
nxtDisplayCenteredTextLine(2, sColor);
wait1Msec(50);
}
}
}
I appreciate your time and help
Who is online
Users browsing this forum: No registered users and 3 guests