Hello:
For some reason, the msleep(int) function isn't working in the install of Kiss IDE.
IDE version 4.0.4, with a 2D simulator built in on Windows 7.
Our code (in C):
#ifndef _test1_H_
#define _test1_H_
int main()
{
printf("started");
motor(0,50);
motor(2,50);
msleep(5000);
printf("about to return 0");
return 0;
}
#endif
What happens in the simulator is that it prints out started, the robot turns on for barely a moment, stops, and then prints out about to return 0. Everything is almost instantaneous.
What we want is the robot to move forward at 50% power for 5 seconds, then stop. It works with a loop when a variable is incremented up to a maximum, but that doesn't run in a specified unit of time, rather a specified unit of number.
Is there an import we're missing or something?
First why do you have your main in a header, and if its not a header why does it have a shield (#ifndef) at the top?
I'm not sure about your problem with msleep though. I have a team meeting later today and I'll see if its working for me then.
Actually, even if we remove the header, and cut the code down to this:
int main()
{
printf("started");
motor(0,0);
motor(2,0);
msleep(4000);
return 0;
}
it still won't work on Windows.
Surprisingly on the Mac OSX Kiss IDE v 4.0.4, the same exact code functions properly.
This issue has been corrected in KISS Platform 4.0.5. We will be releasing KISS 4.0.5 on Wednesday night. As a workaround:
void fixed_msleep(unsigned long msecs)
{
while(msecs) {
const unsigned long current = msecs > 999UL ? 999UL : msecs;
msleep(current);
msecs -= current;
}
}
.......
fixed_msleep(5000);
Braden McDorman
Developer of the KIPR Link, KISS IDE, KIPR's 2D Simulator, and CBCJVM.
Reach me at bmcdorman(cat)kipr(dog)org where (cat)=@ and (dog)=. if you need assistance of any kind.
Thanks guys, helped found what he was looking!
192.168.l.l