Ejemplo n.º 1
0
/////////////////////////////////////////////////////////////
//respond to incoming serial
void SerialIn(long now, String str) {
	String delimStr = ",";
	
	if (str.length()==0) {
		return;
	}
	if (str == "startTrial") {
		startTrial(now);
	}
	else if (str == "stopTrial") {
		stopTrial(now);
	}
	else if (str.startsWith("getState")) {
		GetState();
	}
	else if (str.startsWith("set")) {
		//set is {set,name,value}
		int firstComma = str.indexOf(delimStr,0);
		int secondComma = str.indexOf(delimStr,firstComma+1);
		String nameStr = str.substring(firstComma+1,secondComma); //first is inclusive, second is exclusive
		String valueStr = str.substring(secondComma+1,str.length());
		SetValue(nameStr, valueStr);
	}
	else {
		Serial.println("SerialIn() did not handle:" + str);
	}
		
}
Ejemplo n.º 2
0
void AsyncProfiler::nextTrial()
{
    stopTrial();
    startTrial();
}