Hi E,hi,
OK, can you post a clip showing how
#Define ak8963_st1 0x02
is used/called in the program, see how we can rework it.
E
try:
SYMBOL ak8963_st1 = 0x02' this should assign 0x02 to that label
Hi J,This may work.
#Define info 0x01 - > Const info = 0x01
and then: Spisend info
Hi E,hi,
OK, can you post a clip showing how
#Define ak8963_st1 0x02
is used/called in the program, see how we can rework it.
E
try:
SYMBOL ak8963_st1 = 0x02' this should assign 0x02 to that label
Hi D,I’m not familiar with Oshonsoft, but from your example it appears that “define” is used differently than in Arduino C.
I AM familiar with Arduino code. There is no “=“ in the Arduino “#define” syntax. In Arduino, #define is used to create a macro. Hence:
#define limitUpper 255;is processed at compile time. All occurrences of the token “limitUpper” are replaced by 255. The resultant code is then compiled.
This can also define a common line of code to make the code more readable, like this:
#define IsExitFunc if(digitalRead(pinCtl)==1)exitThen, in the actual code, you can write
IsExitFunc;
Good programming practice is to use the “const” type qualifier for numbers, strings/car arrays. It actually results in smaller code.
Good point. On the Arduino, registers are defined in the header files. If you’ve included the proper header files, you should simply assign the desired values in the setup() function. Particularly near the same code block that the initialization functions are called (this is optional, but helps in debugging.Hi D,
As mentioned, I was using some Arduino code that I've been given, as an example, but every time I try to read Arduino, it confuses me. It just looked neat.
I already have a CONST in my program for [ PI ], but that's a number, and I am not certain CONST can be used for a REG ADDRESS.
Anyway, in my program there is a lot that members here have written for me, that conflict with REG CONST, so I'll leave it for now.
C.
Hi D,Good point. On the Arduino, registers are defined in the header files. If you’ve included the proper header files, you should simply assign the desired values in the setup() function. Particularly near the same code block that the initialization functions are called (this is optional, but helps in debugging.