B4R Question libreria AP_Sync_h

roberto64

Active Member
Licensed User
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
Hi Roberto, maybe you should have posted that in questions sub-forum of B4R.
 
Upvote 0

roberto64

Active Member
Licensed User
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
Top