 | | Re: IC trouble - function definition - understand now, Thanks
|
|
Sorry, Forgot to enclose the code. what is wrong here? long time; void phony() { while (digital(2) == 1) { time = mseconds(); printf("%d\n", mseconds()); } if (mseconds () >1413 ) fd(1); else bk(1); } void start() { phony(); } void main() { while(1) (...) (27 years ago, 13-Nov-99, to lugnet.robotics.handyboard)
|
| |
 | | Re: IC trouble - function definition - understand now, Thanks
|
|
John, Have been following your problems with function definition. what is wrong with this code? It will print the mseconds but the if statement does not work. Thanks Terry -----Original Message----- From: John Bachman <bachman@anatek.mv.com> To: (...) (27 years ago, 13-Nov-99, to lugnet.robotics.handyboard)
|
| |
 | | Re: IC trouble - function definition - understand now, Thanks
|
|
Rich got it. Nested functions was the problem. I don't recall seeing that discussed in the IC manual and I think it is OK in C. Nonetheless, thanks to all for helping this hapless programmer. John (...) (27 years ago, 13-Nov-99, to lugnet.robotics.handyboard)
|
| |
 | | Re: IC trouble - function definition
|
|
(...) whoa! Local function definitions. Even GCC doesn't grok that. Try extracting the function definition phony() from start() like so: long time; void phony() { while (digital(2) == 1) { time = mseconds(); } } void start() { phony(); } -d (...) (27 years ago, 13-Nov-99, to lugnet.robotics.handyboard)
|
| |
 | | Re: IC trouble - function definition
|
|
[John Bachman] spake unto the ether: (...) You have the definition of phony() nested inside the definition of start(). I don't know what ANSI C and/or C++ let you do, but this is invalid IC. You need something like: long time; void start() { (...) (27 years ago, 13-Nov-99, to lugnet.robotics.handyboard)
|