5 #include "../hubolib.h"
19 string GetDateTime(
char seperator,
char timeSeperator);
22 int main(
int argc,
char* argv[])
26 printf (
"Usage: \n Analogdump <sample rate [ms]> <filename>\n example: Analogdump 1000 test.csv\n");
31 if (sscanf (argv[1],
"%ld", &logSpeed) != 1)
33 printf (
"Logspeed could not be determined!\n");
38 if (sscanf (argv[2],
"%s", buffer) != 1)
40 printf (
"File name could not be determined!\n");
43 string sFile = buffer;
48 printf (
"Error: Initialize\n");
60 unsigned long adcCount;
74 sprintf (buffer,
"%04ld ", adcCount);
78 sprintf (buffer,
" ");
83 printf (
"%s", sLine.c_str());
86 usleep(1000L * logSpeed);
98 struct tm *pNow = localtime (&t);
100 sprintf (buffer,
"%02d.%02d.%d%c%02d%c%02d%c%02d", pNow->tm_mday, (pNow->tm_mon + 1), (pNow->tm_year + 1900), seperator, pNow->tm_hour, timeSeperator, pNow->tm_min, timeSeperator, pNow->tm_sec);
102 return string(buffer);
107 FILE* pFile = fopen (sFile.c_str(),
"a+");
110 bool bResult = fputs (sText.c_str(), pFile) > 0;
bool Wait_For_MCP3x08_Buffered_Values()
Waits until the input buffer of the MCP3x08 are initialized from the hardware.
#define MAX_MCP3x08_CHANNELS
bool Initialize()
Initializes the library.
bool AppendFile(string sFile, string sText)
void Uninitialize()
Releases any resources bound to the library.
string GetDateTime(char seperator, char timeSeperator)
int main(int argc, char *argv[])