hi, i have the following code, the dusk or dawn sensor will sense and give the output to microcontroller and the MC should compare dusk or dawn and switch the relay accordingly... but the program which i wrote is wrong i guess and im very bad in programming could anyone pls help me in this case...
Rich (BB code):
#include "p18f4550.h"
#include "string.h"
#include "stdio.h"
#include "delays.h"
#include "p18cxxx.h"
#define macro
//#define PORTAbits.RB4
void main()
{
int load=0;
int batt=0;
int relay=0;
int i;
char time[10];
/* Compare two strings without regard to case */
if (strcmp("night","day")==0)
printf("day\n");
else
printf("night\n");
b:
if(strcmp(time,"night")==0)
{
a:
do
{
relay=1;
load=1;
//printf("charging\n");
}
while(batt!=1);
//printf("battery full\n");
relay=0;
i=300;
while(i>0)
{
//delay_ms(1000);
Delay100TCYx(1000);
//printf("battery value\n");
i--;
}
goto a;
}
else if(strcmp(time,"day")==0)
{
do
{
load=0;
//printf("load off\n");
}
while(batt!=0);
load=1;
//printf("low battery\n");
//while(RA4==1)
//printf("battery value\n");
//goto b;
}
}