Code:: Variable from one cpp to another cpp

Pardon my coding skills as i just picked it up recently… i am currently trying to send one variable from rc_channel.cpp to rcoutput.cpp.

in RC_Channel.h i added my variable under class RC_Channel public :
uint8_t turtlerc;

in RC_Channel.cpp. i added my own function and tried to set the turtlerc value to 50.
turtlerc = 50;

in RCOutput.h i included the
#include “RC_Channel/RC_Channel.h”
public:
RC_Channel turtlemode;

in RCOutput.cpp in one of the function i tried to get the variable turtlerc and print;

      hal.uartD->printf("mode = %d \n", turtlemode.turtlerc);

it only print mode = 0.

if i declare the turtlerc with a value in the rc_channel.h. i can print the value i declare… but if i set the value in a function,it will just print zero…

is there a way i can send one value from one cpp file to another file. thank you so much…

Not sure because I don’t see the code but you probably print the variable before setting the value to your variable

the best place for code help is the dev gitter channel, https://gitter.im/ArduPilot/ardupilot ideally with a link to the github branch your working on.