| | #define-ing stuff for Chibots
|
| (...) I'm not totally sure about this, but try playing around with #define In one language I use, the compiler will totally take out the variable, and put in the defined value, before compiling the program. I assume that's how it should work in C (...) (19 years ago, 3-Oct-05, to lugnet.org.us.laflrc)
| | | | Re: #define-ing stuff for Chibots
|
| (...) I have, and it helps a lot. For instance, when comparing the raw light sensor values to some limit, I #define "<" to be "LIGHTER_THAN", for instance. That makes switching all those points very easy in the code, I need only change two #defines (...) (19 years ago, 3-Oct-05, to lugnet.org.us.laflrc)
| | | | Re: #define-ing stuff for Chibots
|
| (...) Or a different way #define BLACKLINE 1 #if BLACKLINE #define SEELINE(reading,threshold) reading < threshold #else #define SEELINE(reading,threshold) reading > threshold #endif if (SEELINE(s1,threshold1)) { // s1 is on the line } else { // s1 (...) (19 years ago, 8-Oct-05, to lugnet.org.us.laflrc)
| |