void pmx::ArduinoBoard::begin()
{
	try
	{
		//open i2c and setslave
		ardui_i2c_.open(addr_);

		int ack = 0;
		ack = launchCmd("ACK", "Acknowledge");

		if (ack == 125)
		{
			connected_ = true;
		}
		else
		{
			logger().error() << "init() : ArduinoBoard(" << addr_ << ") is now OFF, ack=" << (int) ack  << " not eq 125 !"<< utils::end;
		}

	} catch (utils::Exception * e)
	{
		logger().error() << "init()::Exception - ArduinoBoard(" << addr_ << ") NOT CONNECTED !!! (ack test) " //<< e->what()
				<< utils::end;
	}
}
Example #2
0
int main () {

char *command;
char **commandList;

int stop = 0;
char exitStatus[256];
int bg_status;
pid_t wpid;
pid_t bgids[100] = {0};

struct sigaction act;

do {
	//Wait for a background child process if it exists
	waitbg(&wpid, &bg_status, bgids); 

	//Ignore SIGINT signals
	//Code provided by instructor on Canvas
	act.sa_flags = 0;
	act.sa_handler = SIG_IGN;
	sigaction(SIGINT, &act, NULL);	

	//Display the prompt
	printf(": ");

	//Read in the command
	command = readLine();
	
	//Parse the command into an array
	commandList = parseLine(command);
	
	//Execute the command
	stop = launchCmd(commandList, exitStatus, &act, &bg_status, bgids);

	//Deallocate the memory
	free(command);
	//Return to a null pointer
	command = NULL;

	//Deallocate the list and return to null pointer
	free(commandList);
	commandList = NULL;

} while (stop == 0);

return 0;
}
Example #3
0
int launchSETREPLICATION(const char *url, struct Response **resp)
{
    return launchCmd(url, PUT, NO, resp);
}
Example #4
0
int launchNnAPPEND(const char *url, struct Response **resp)
{
    return launchCmd(url, POST, NO, resp);
}
Example #5
0
int launchNnWRITE(const char *url, struct Response **resp)
{
    return launchCmd(url, PUT, NO, resp);
}
Example #6
0
int launchUTIMES(const char *url, struct Response **resp)
{
    return launchCmd(url, PUT, NO, resp);
}
Example #7
0
int launchDELETE(const char *url, struct Response **resp)
{
    return launchCmd(url, DELETE, NO, resp);
}
Example #8
0
int launchLS(const char *url, struct Response **resp)
{
    return launchCmd(url, GET, NO, resp);
}