Can you show me this program from NXT-G to RobotC ?
Can you show me this program from NXT-G to RobotC ?
Can you show me this program from NXT-G to RobotC ?
http://www.laurensvalk.com/images/downl ... 527&ex=rbt
thank you!
http://www.laurensvalk.com/images/downl ... 527&ex=rbt
thank you!
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: Can you show me this program from NXT-G to RobotC ?
You want that NXT-G program converted into ROBOTC?
Here is now I would go about doing it:
Here is now I would go about doing it:
- - Determine the logic used.
- Create a loop and if statements to represent the loop and switches in the NXT-G program.
- Build ROBOTC chunks of code to represent the NXT-G blocks.
- Test to confirm it is working.
- Optimize the program by cutting out unnecessary lines of code.
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: Can you show me this program from NXT-G to RobotC ?
I'm not gonna convert all the blocks into text code, but here is the logic (in NXC, not ROBOTC):That should be the same logic layout, you just need to build it in ROBOTC.
Code: Select all
task main(){
SetSensorLight(S4);
SetSensorType(S4, SENSOR_TYPE_LIGHT_ACTIVE);
while(true){
Wait(300);
if(SENSOR_4<34){
}
else{
if(SENSOR_4>48){
}
else{
}
}
}
}
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
Re: Can you show me this program from NXT-G to RobotC ?
oh I saw the source code but I cant control the motors with the light sensor... ;o/ Im new in this LEGO "World" and I must be done whit this project after 2 days... ;o/ I beg you to show me the whole source code... this is very important
thanks!
thanks!
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: Can you show me this program from NXT-G to RobotC ?
I told you that was only the logic (and it's only the main structure for that matter), and in NXC (not ROBOTC). What I showed you is not source-code for the NXT-G program; it's my own hand-coded NXC program that makes up the logic used in the NXT-G program.
Why such a time-frame?
Like I said before, I don't program in ROBOTC. I can't magically convert an NXT-G program into ROBOTC, or any other language.
Why do you need the program in ROBOTC? What is the program for? Do you know that the NXT-G program works fine the way it is?
Why such a time-frame?
Like I said before, I don't program in ROBOTC. I can't magically convert an NXT-G program into ROBOTC, or any other language.
Why do you need the program in ROBOTC? What is the program for? Do you know that the NXT-G program works fine the way it is?
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
Re: Can you show me this program from NXT-G to RobotC ?
this is simple color sorter
here is the project:
http://www.laurensvalk.com/nxt-1_0-only ... orter-8527
it must be on RobotC because my professor want this ;o/
here is the project:
http://www.laurensvalk.com/nxt-1_0-only ... orter-8527
it must be on RobotC because my professor want this ;o/
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: Can you show me this program from NXT-G to RobotC ?
Does it need to be ROBOTC? Can it be NXC? Do you need a literal interpretation of it? Is a functionally equivalent version fine? Does it need to make sounds?
If this is for a school project, shouldn't you do the work?
If this is for a school project, shouldn't you do the work?
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
Re: Can you show me this program from NXT-G to RobotC ?
without sounds... but okay write this program on NXC and I will try to make changes to work in RobotC
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: Can you show me this program from NXT-G to RobotC ?
Well, I can try to make a working program in NXC. However, if you can't even begin to convert this yourself, I don't know how you will convert the NXC program into ROBOTC.
Can you please answer the other questions from my last post?
Can you please answer the other questions from my last post?
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: Can you show me this program from NXT-G to RobotC ?
Well, here is an untested NXC program that I came up with.
Code: Select all
bool PosRegComplete(byte port, int tolerance, long position){
if (MotorTachoCount (port)>=(position-tolerance)&&MotorTachoCount (port)<=(position+tolerance))
}
void Push(){
PosRegSetAngle (OUT_B, -85);
until(PosRegComplete(OUT_B, 5, -85));
PosRegSetAngle (OUT_B, 0);
until(PosRegComplete(OUT_B, 5, 0));
}
task main(){
PosRegEnable (OUT_A);
PosRegSetMax (OUT_A, 0, 0);
PosRegEnable (OUT_B);
PosRegSetMax (OUT_B, 0, 0);
SetSensorLight(S4);
SetSensorType(S4, SENSOR_TYPE_LIGHT_ACTIVE);
while(true){
Wait(300);
if(SENSOR_4<34){ //Black
PosRegSetAngle (OUT_A, 50);
until(PosRegComplete(OUT_A, 5, 50));
Push();
}
else{
if(SENSOR_4>48){ //White
PosRegSetAngle (OUT_A, -50);
until(PosRegComplete(OUT_A, 5, -50));
Push();
}
else{ //Gray
PosRegSetAngle (OUT_A, 0);
until(PosRegComplete(OUT_A, 5, 0));
Push();
}
}
}
}
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
Who is online
Users browsing this forum: No registered users and 1 guest