Subject:
|
Possible bug? Simple light sensor condition checking.
|
Newsgroups:
|
lugnet.robotics.rcx.legos
|
Date:
|
Mon, 16 Jul 2007 15:13:17 GMT
|
Viewed:
|
16248 times
|
| |
| |
I tried my own skill on writing a program for the included lego test pad (RIS
2.0), and I discovered something weird. The following code does set the
conditions right, but the following code doesn't set the conditions right if I
comment out the 'cputs("");'. Any idea why?
int offonpad =0;
int check_off_pad(int argc, char *argv[]) {
while(!shutdown_requested()) {
if(LIGHT(LIGHTSENS) < 40) {
offonpad = 1;
}
else {
offonpad = 0;
}
cputs("");
}
return 0;
}
What doesn't work is (it fails to set the varible, if i initialize offonpad as
1, its always one. If i initialize offonpad as 0, it is always zero.):
int check_off_pad(int argc, char *argv[]) {
while(!shutdown_requested()) {
if(LIGHT(LIGHTSENS) < 40) {
offonpad = 1;
}
else {
offonpad = 0;
}
//cputs("");
}
return 0;
}
|
|
Message has 1 Reply:
3 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|