Example #1
0
int main(int argc, char **argv)
{

setShowLogs(1);

DomoDevice dev = attachDomoDevice ("DomoSy-Arduino-5141-9267");

DomoDevice dev2 = attachDomoDevice ("DomoSy-Arduino-1633-3668");
if (dev.fd != -1 && dev2.fd != -1 )
{
setPinModeAsOutput (&dev, 22);
setPinModeAsOutput (&dev, 23);
setPinModeAsInput (&dev2, 22);
setPinModeAsOutput (&dev2, 23);
int i = 0;
/*for (i = 0; i < 5; i ++)
{
setPinHigh (&dev, 23);
setPinLow (&dev2, 23);
sleep(2);

setPinHigh (&dev2, 23);
setPinLow (&dev, 23);
sleep(2);



}*/
setPinHigh (&dev, 23);
 sleep(2);
setPinHigh (&dev, 22);
setPinLow (&dev, 23);
printf("Pin status=%d\n", getPinStatus(&dev2, 22));
 if (getPinStatus(&dev2, 22)==1) 
setPinHigh (&dev2, 23);
sleep(2);
setPinLow (&dev, 23);



detachDomoDevice (&dev);
detachDomoDevice (&dev2);
}
else
{
printf("Can not open UUGear device.\n");	
}

//cleanupDomo();

    return 0;
}
Example #2
0
bool PHN_Sim::enterPin(const char* pin) {
  // Build the enter pin command
  char command[50];
  String commandStr;
  commandStr += "AT+CPIN=";
  commandStr += pin;
  commandStr.toCharArray(command, sizeof(command));

  if (sendATCommand(command) && (getPinStatus() == SIM_PIN_STATUS_READY)) {
    return true;
  }
  return false;
}
int main(int argc, char **argv)
{
	setupUUGear();
	
	setShowLogs(1);
	
	UUGearDevice dev = attachUUGearDevice ("UUGear-Arduino-7853-2668");
	
	if (dev.fd != -1)
	{
		double begin, end;
		
		begin = getCurTime();
		int value = analogRead(&dev, 3);
		end = getCurTime();
		printf("Analog read on A3 takes %f ms, value=%d\n", end - begin, value);
		
		begin = getCurTime();
		setPinModeAsInput (&dev, 9);
		end = getCurTime();
		printf("Set pin mode on D9 takes %f ms\n", end - begin);
		
		begin = getCurTime();
		value = getPinStatus(&dev, 9);
		end = getCurTime();
		printf("Digital read on D9 takes %f ms, value=%d\n", end - begin, value);			
		
		detachUUGearDevice (&dev);
	}
	else
	{
		printf("Can not open UUGear device.\n");	
	}

	cleanupUUGear();
		
    return 0;
}