Hi,
I ran the following simple code and the NXT 2.0 brick just hangs. I keep hearing some ticks but nothing else happens. I upgraded the firmware to 1.31 to make sure but that did not help. Does anyone have any ideas? I assume that float variables are supported in NXT 2.0. Here is the code snippet that causes the problem.
#define Kproportional 6
task main(){
int error = 0;
float proportional = 0;
proportional = Kproportional * error;
}
Thanks for the help.
NXC float
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: NXC float
It runs just fine for me. I am using version 1.32 of John's EFW.
Try this so you can actually see the result:Although with an error of 0, the result should be 0 (6*0=0).
Try this so you can actually see the result:
Code: Select all
#define Kproportional 6
task main(){
int error = 0;
float proportional = 0;
proportional = Kproportional * error;
NumOut(0, LCD_LINE1, proportional);
while(true);
}
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: 220
- Joined: 23 Jan 2012, 17:07
- Location: Round Rock, TX
Re: NXC float
roboteer, I had a similar problem with float when I first started using NXC. However, I can't remember what the problem turned out to be. It was something really simple though. (I suffer from CRS = Can't Remember Stuff. )
McSummation aka James
http://www.mcsummation.com/Mindstorms/
http://www.mcsummation.com/Mindstorms/
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: NXC float
Oh, make sure you have your FW related compiler settings set according to your NXT FW version.
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: 220
- Joined: 23 Jan 2012, 17:07
- Location: Round Rock, TX
Re: NXC float
What version of the compiler and BricxCC are you using?
McSummation aka James
http://www.mcsummation.com/Mindstorms/
http://www.mcsummation.com/Mindstorms/
Re: NXC float
And you have the latest enhanced firmware?
Thanks, and have a nice day,
nxtboy III
programnxt.com
nxtboy III
programnxt.com
Re: NXC float
Yup, I got it working. I had a very old version of the firmware installed. By the way, it matters how the color sensor is physically installed. I installed it on the back of the robot and my program now drives it backwards around the track. In case anyone wanted to know.
Thanks for all the help.
Thanks for all the help.
Who is online
Users browsing this forum: No registered users and 4 guests