Example #1
0
int main(int argc, char *argv[])
{
   int i, t, c, pi;

   char test[64];

   if (argc > 1)
   {
      t = 0;

      for (i=0; i<strlen(argv[1]); i++)
      {
         c = tolower(argv[1][i]);

         if (!strchr(test, c))
         {
            test[t++] = c;
            test[t] = 0;
         }
      }
   }
   else strcat(test, "0123456789");

   pi = pigpio_start(0, 0);

   if (pi < 0)
   {
      fprintf(stderr, "pigpio initialisation failed (%d).\n", pi);
      return 1;
   }

   printf("Connected to pigpio daemon (%d).\n", pi);

   if (strchr(test, '0')) t0(pi);
   if (strchr(test, '1')) t1(pi);
   if (strchr(test, '2')) t2(pi);
   if (strchr(test, '3')) t3(pi);
   if (strchr(test, '4')) t4(pi);
   if (strchr(test, '5')) t5(pi);
   if (strchr(test, '6')) t6(pi);
   if (strchr(test, '7')) t7(pi);
   if (strchr(test, '8')) t8(pi);
   if (strchr(test, '9')) t9(pi);
   if (strchr(test, 'a')) ta(pi);
   if (strchr(test, 'b')) tb(pi);
   if (strchr(test, 'c')) tc(pi);

   pigpio_stop(pi);

   return 0;
}
Example #2
0
static void servoOutOnExit(void)
{
	printf("Disconnecting Servos Output ...\n");
    
    // disconnect from the daemon if still running
    if(isDaemonStarted)
    {
    	 // stop all outputs
		HAL_SERVO_PULSES_STOP();

    	pigpio_stop();
    	isDaemonStarted = false;
    }
}
Example #3
0
static void servoInOnExit(void)
{
	printf("Disconnecting Servos Input ...\n");

	// cancel any registered callbacks
	for(uint32_t i = 0; i < gpioInputCount; i++)
	{
		callback_cancel(inputCallbackIds[i]);
	}

	if(isDaemonStarted)
	{
		// disconnect from the daemon if still running
    	pigpio_stop();
    	isDaemonStarted = false;
    }
}
Example #4
0
int main(int argc, char *argv[])
{
   int t, status;
   void (*test[])(void) = {t0, t1, t2, t3, t4, t5, t6, t7, t8, t9};

   status = pigpio_start(0, 0);

   if (status < 0)
   {
      fprintf(stderr, "pigpio initialisation failed.\n");
      return 1;
   }

   printf("Connected to pigpio daemon.\n");

   for (t=0; t<10; t++) test[t]();

   pigpio_stop();

   return 0;
}