I have serial communication set up between my computer and arduino. On the computer I am using processing. I have the code working pretty well and am now trying to use encoders. I have used them in the past, but I have since then rewritten my code more organized and object oriented. As such, I declare my encoders in the main script and then pass them by pointer to a function that should be able to read them and write to the serial port given its in the right mode.
I have 3 encoders and defined them as Encoder* enc[3] so I could have an array of pointers to them. In the function they are passed to it simply does:
Serial.println(enc[0]->read());
But the values I'm getting appear to more likely be a memory address. I thought -> dereferenced, but maybe I'm just getting the memory address of the read function in encoder?
aaddcc:
Hello,
I have serial communication set up between my computer and arduino. On the computer I am using processing. I have the code working pretty well and am now trying to use encoders. I have used them in the past, but I have since then rewritten my code more organized and object oriented. As such, I declare my encoders in the main script and then pass them by pointer to a function that should be able to read them and write to the serial port given its in the right mode.
I have 3 encoders and defined them as Encoder* enc[3] so I could have an array of pointers to them. In the function they are passed to it simply does:
Serial.println(enc[0]->read());
But the values I'm getting appear to more likely be a memory address. I thought -> dereferenced, but maybe I'm just getting the memory address of the read function in encoder?