I am looking for solution for something wrong happen in my programme i have configuration for control RC motor over RasPi using Wiring Pi here is code
#include<stdio.h>
#include<netinet/in.h>
#include<sys/types.h>
#include<sys/socket.h>
#include<netdb.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
// header files for wiring to servo WIringPi
#include <wiringPi.h>
#include <softPwm.h>
#define PIN 0
//main programme that inittiate all socket for server
int main()
{
int i;
//declaration for Wiring COnfiguration
if(wiringPiSetup()==-1)
{
printf("Setup to servo fail");
exit(0);
}
else
{
printf("Servo setup Done \n");
}
pinMode(0,OUTPUT);
digitalWrite(0,LOW);
printf("started \n");
softPwmCreate(0,0,200);
for (;;)
{
printf("start a loop");
for (i = 0 ; i <=180 ; ++i)
{
softPwmWrite (PIN, i) ;
printf("\n Loop : %d ",i );
delay (100) ;
}
delay (300) ;
for (i = 180 ; i >= 0 ; --i)
{
softPwmWrite (PIN, i) ;
printf("\n Loop : %d",i);
delay (100) ;
}
delay (10) ;
}
}
i dont know what is wrong with this code
When It takes angle as 5 it start moving and moves total 180 degree when input integer i = 25
so its like
i=5 then 0 degree
and i=25 then 180 degree
If anyone can help what is wrong?