int main(int argc, char **argv) {
	setvbuf(stdout, NULL, _IONBF, 0); // needed to print to the command line

	int x;
	int a;

	// initialise the servo pi on I2C address 0x40 with the Output Enable pin enabled.
	// Check the returned value to ensure the Servo Pi initialised correctly

	a = servopi_init(0x40, 1);
	if (a != 0) {
		if (a == 1) {
			printf("Error enabling GPIO Pin");
		}
		if (a == 2) {
			printf("Error setting GPIO Pin direction");
		}
		return (0);
	}

	//Set PWM frequency to 60 Hz and enable the output
	set_pwm_freq(60, 0x40);
	output_enable();

	while (1) {
		set_pwm(1, 0, servoMin, 0x40); // set the pwm width to servoMin
		usleep(500000); // sleep 0.5 seconds
		set_pwm(1, 0, servoMed, 0x40); // set the pwm width to servoMed
		usleep(500000); // sleep 0.5 seconds
		set_pwm(1, 0, servoMax, 0x40); // set the pwm width to servoMax
		usleep(500000); // sleep 0.5 seconds
	}

	return (0);
}
int main(int argc, char **argv) {
	setvbuf(stdout, NULL, _IONBF, 0); // needed to print to the command line

	int x;
	int a;

	// initialise the servo pi on I2C address 0x40 with the Output Enable pin enabled.
	// Check the returned value to ensure the Servo Pi initialised correctly

	a = servopi_init(0x40, 1);
	if (a != 0){
		if (a == 1){
			printf("Error enabling GPIO Pin");
		}
		if (a == 2){
			printf("Error setting GPIO Pin direction");
		}
		return (0);
	}

	//Set PWM frequency to 1 Khz and enable the output
	set_pwm_freq(1000, 0x40);
	output_enable();



	while (1) {
		for (x = 1; x <= 4095; x = x + 5) {
			set_pwm(1, 0, x, 0x40); // set the pwm width to x
		}

		for (x = 4095; x >= 0; x = x - 5) {
			set_pwm(1, 0, x, 0x40); // set the pwm width to x
		}

	}

	return (0);
}
int main(int argc, char **argv) {
	setvbuf(stdout, NULL, _IONBF, 0); // needed to print to the command line

	int x;
	int a;

	// initialise the servo pi on I2C address 0x40.  Check the returned value to ensure the Servo Pi initialised correctly

	a = servopi_init(0x40, 1);
	if (a != 0){
		if (a == 1){
			printf("Error enabling GPIO Pin");
		}
		if (a == 2){
			printf("Error setting GPIO Pin direction");
		}
		return (0);
	}

	set_allcall_address(0x60, 0x40);
	enable_allcall_address(0x40);

	return (0);
}