MCPcopy Create free account
hub / github.com/Beckhoff/ADS / readWriteArrayExample

Function readWriteArrayExample

example/example.cpp:92–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90}
91
92static void readWriteArrayExample(std::ostream &out, const AdsDevice &route)
93{
94 static const std::array<uint8_t, 4> arrayToWrite = { 1, 2, 3, 4 };
95 AdsVariable<std::array<uint8_t, 4> > arrayVar{ route, "MAIN.byByte" };
96 arrayVar = arrayToWrite;
97 std::array<uint8_t, 4> readArray = arrayVar;
98 out << "Wrote array with first value " << (uint32_t)arrayToWrite[0]
99 << " and last value " << (uint32_t)arrayToWrite[3] << "\n";
100 out << "Read back array with first value " << (uint32_t)readArray[0]
101 << " and last value " << (uint32_t)readArray[3] << "\n";
102}
103
104static void readStateExample(std::ostream &out, const AdsDevice &route)
105{

Callers 1

runExampleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected