We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
ive got this code and dont know what is wrong.
#define a 1 #define b 2 #define c 3 #define 22 37 #define binary1 0x01 #define binary2 0x02 #define binary3 0x04 #define binary4 0x08 #define binary5 0x09 #define binary6 0x10 #define binary7 0x20 int toggle__pin ( int port , int pin ) { if ( port == a && pin == 1 ) { P0 = binary1; delay(1); P0 = ~binary1; } if ( port == a && pin == 2 ) { P0 = binary2; delay(1); P0 = ~binary2; } // repeated return 23; }
"Everywhere your code has an a it will be substituted, not just where you think it will be."
The preprocessor works on tokens, not on individual characters, so the C preprocessor will not replace any a that is part of a longer token or that is inside a C string.