roberto64 Active Member Licensed User Longtime User Dec 6, 2020 #1 Hi, I don't know c, can someone help me to create a B4R library with this code? Thanks AP_Sync: #ifndef AP_Sync_h #define AP_Sync_h #if ARDUINO >= 100 #include "Arduino.h" #else #include "WProgram.h" #endif const char valueStart = ':'; const char dataStart = '#'; const char dataEnd = '|'; class AP_Sync{ public: AP_Sync(Stream& s):serial(s){} template <typename T> void sync(T t) { serial.print(valueStart); serial.print(t); serial.print(dataEnd); serial.println(); } template<typename T, typename... Args> void sync(T t, Args... args) // recursive variadic function { serial.print(dataStart); serial.print(t); sync(args...); } private: Stream& serial; }; #endif
Hi, I don't know c, can someone help me to create a B4R library with this code? Thanks AP_Sync: #ifndef AP_Sync_h #define AP_Sync_h #if ARDUINO >= 100 #include "Arduino.h" #else #include "WProgram.h" #endif const char valueStart = ':'; const char dataStart = '#'; const char dataEnd = '|'; class AP_Sync{ public: AP_Sync(Stream& s):serial(s){} template <typename T> void sync(T t) { serial.print(valueStart); serial.print(t); serial.print(dataEnd); serial.println(); } template<typename T, typename... Args> void sync(T t, Args... args) // recursive variadic function { serial.print(dataStart); serial.print(t); sync(args...); } private: Stream& serial; }; #endif
hatzisn Well-Known Member Licensed User Longtime User Dec 6, 2020 #2 Hi Roberto, maybe you should have posted that in questions sub-forum of B4R. Upvote 0
hatzisn Well-Known Member Licensed User Longtime User Dec 7, 2020 #3 You can use B4RSerializator, the Serial's stream of B4R and AsyncStreams object which is contained in rRandomAccess library. Upvote 0
You can use B4RSerializator, the Serial's stream of B4R and AsyncStreams object which is contained in rRandomAccess library.
roberto64 Active Member Licensed User Longtime User Dec 7, 2020 #4 Hi hatzisn, thanks for your reply, i'm trying to use processing with B4R for data exchange, trying AsyncStreams with B4R Arduino processing reads the data, but from processing and arduino no.thanks Upvote 0
Hi hatzisn, thanks for your reply, i'm trying to use processing with B4R for data exchange, trying AsyncStreams with B4R Arduino processing reads the data, but from processing and arduino no.thanks