Closed ideasoft-bz closed 3 years ago
Hello Bojan, it should look something like this:
AdsVariable<bool> readVarBool {route, ".myBool"};
for type BOOLAdsVariable<int16_t> readVarInt {route, ".myInt"};
for type INTAdsVariable<int32_t> readVarDInt {route, ".myDInt"};
for type DINT etc.AdsVariable<float> readVarReal {route, ".myReal"};
for type REALJust make sure the size of the variables is the same in TwinCAT and on your platform. You can find more information on type sizes here.
You can assign the value of the variable using the assignement operator:
bool value = readVarBool;
Hope I could help you.
Super, thank you very much.
Regards Boajn
Hello,
My C++ knowledge is not good enough to decode AdsVariable. In the example
static void readByNameExample(std::ostream& out, const AdsDevice& route) { AdsVariable readVar {route, ".StevPalet"};
}
This example works, but how do I decode return data if my request is for variable type of bool, int, real?
Thank you very much for help
Regards Bojan