#include <10F206.h> #FUSES NOWDT //No Watch Dog Timer #FUSES MCLR //No Master Clear pin #FUSES NOPROTECT //No code protected from reads #use delay(clock=4000000) #define set_options(value) {#ASM \ MOVLW value \ OPTION \ #ENDASM} #define SWITCH PIN_B0 #define FET PIN_B1 #define SERVO PIN_B2 #define NOMCLR PIN_B3 void SWITCH_UIT_ZETTEN() { output_high(SERVO); delay_us(2000); output_low(SERVO); delay_ms(18); } void TERUG_BAKKIE_IN() { int i; for(i=0; i <30;i++)//rechtsom = terug het bakkie in...//was 20 { output_high(SERVO); delay_us(500); output_low(SERVO); delay_ms(20);// was 40 if(input(PIN_B0)) { do { SWITCH_UIT_ZETTEN(); }while(input(PIN_B0)); i = 0; } } } int i; main() { setup_comparator(NC_NC); // Enable pull-ups, wake-up on change, and Pin B2 for normal i/o. set_options(0x1F); output_high(FET); //servo enable do { SWITCH_UIT_ZETTEN(); }while(input(PIN_B0)); if(!(input(PIN_B0))) { TERUG_BAKKIE_IN(); } output_low(FET); //servo disable output_low(SERVO); sleep(); while(1); }