plotly interface based on ardunio sample code
Library for plotting a simple x/y scatter chart on the plot.ly website.
See plotly_HelloWorld for sample usage.
plotly.h
- Committer:
- AndyA
- Date:
- 2014-07-29
- Revision:
- 6:e57d6e9313f4
- Parent:
- 2:d53d74ed68ac
- Child:
- 7:9409a72ab6c0
File content as of revision 6:e57d6e9313f4:
#ifndef plotly_streaming_ethernet_h #define plotly_streaming_ethernet_h #include <EthernetInterface.h> #include <TCPSocketConnection.h> #define k_bufferSize 512 class plotly { public: plotly(const char *username, const char *api_key, const char* stream_tokens[], const char *filename, int nTraces); ~plotly(); bool init(); void openStreams(); void closeStreams(); void openStream(int stream); void closeStream(int stream); void reconnectStream(int stream); void plot(unsigned long x, int y, int stream = 0); void plot(unsigned long x, float y, int stream = 0); void plot(float x, float y, int stream = 0); int log_level; bool dry_run; int maxpoints; bool world_readable; bool convertTimestamp; char *timezone; char *fileopt; private: bool print_(int d,int stream = 0); bool print_(unsigned long d,int stream = 0); bool print_(float d,int stream = 0); bool print_(char *d,int stream = 0) {return print_((const char *)d, stream);}; bool print_(const char *d,int stream = 0); bool printHex_(uint16_t d,int stream = 0); bool sendFormatedText(char* data, int size,int stream = 0); char buffer[512]; // char rxBuffer[128]; TCPSocketConnection **sockets; unsigned long fibonacci_; const char *username_; const char *api_key_; const char** stream_tokens_; const char *filename_; int nTraces_; bool initalised; }; #endif