I've been programming for a bit and STILL have troubles with my pointers. I have a piece of code I am editing and wish to keep conformance with how all other functions are formatted. Unfortunately, this means I need to pass an array through 3 functions before it gets written out the serial port. Somewhere I'm losing the contents of the array and using an address and am trying to figure out where and how to fix it. And yes, using the serial output function directly works but I can't do that in the actual code.
I have 3 classes, actuator, thruster, and serial.
This is called over and over in an actuator class function:
allThrusters is a thruster class object.
int SendCommand(void *command, int length);
nt thruster::SendCommand(void *command, int length)
nwrote = myserial->WriteSerial(command, length);
myserial is a serial class object.
int WriteSerial(void* buff, int length);
The send is successfull if I do:
int thruster::SendCommand(void *command, int length)
char test="Hello world!\n";
nwrote = myserial->WriteSerial(test,13);
//nwrote = myserial->WriteSerial(command, length);
I get Hello World! out of the serial port. So Im doing something wrong with passing the array through the pointers. Can anyone help me out? The array going into the original function (SerOut1) is fine and has the values I am expecting in it (viewed with a printf).