norhankhaled
Newbie level 1
hey guys
i am new in programming micro controllers , and i was trying to make solar tracking using pic 16f877a , 2 LDR and a stepper motor
but my code doesn't work , can someone help me with this please
i am new in programming micro controllers , and i was trying to make solar tracking using pic 16f877a , 2 LDR and a stepper motor
but my code doesn't work , can someone help me with this please
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 unsigned int v1; //LDR1 unsigned int v2; //LDR2 void main() { TRISA=0xFF; TRISC=0x00; while(1) { ADCON0=0b10000101; v1 = read_adc(); ADCON0=0b10001101; v2 =read_adc(); if (v1 > v2) { PORTC=0b00000001; delay_ms(1000); } if (v2 > v1 ) { PORTC=0b00001000; delay_ms(1000); } if (v1 = v2) { } } }
Last edited by a moderator: