Bicycle Handlebar Light.

include <12F675.h>
use delay (clock=8000000)
fuses INTRC_IO,WDT,PUT,NOBROWNOUT,PROTECT,NOPUT,NOCPD,NOMCLR
define light1 PIN_A0
define art PIN_A4
define azt PIN_A1
define uyarlight PIN_A5
ROM 0x3ff = {0x3480}

int panelvolt;
int deger;
int lightval;
//—————————————–
void isikyak()
{
if( deger < lightval)
{
output_high(light1);
}
else
{
output_low(light1);
}

  deger+=2;

}
//—————————————–
void yak(int16 sure)
{
output_high(light1);
delay_ms(sure);
output_low(light1);
delay_ms(200);
}

//—————————————–
void main() {

int panelvolt, calsmode=3, mode=5;
int depo100;
int16 flashtime;

setup_wdt(WDT_2304MS);
SETUP_TIMER_1(T1_DISABLED );
setup_comparator(NC_NC_NC_NC);

port_a_pullups(0b10010);

/*
depo100=read_eeprom(10);
if(depo100>220) depo100=0;

if(depo100 <= 200) goto normalcalis;
do{
output_A(0b00100000);
delay_ms(500);
output_A(0b00000000);
delay_ms(500);
}while(TRUE);

normalcalis:
depo100++;
write_eeprom( 10 , depo100 );

*/

mode = read_eeprom(0);
calsmode = mode;
if ( mode > 9 ) mode = 3;

setup_ADC_ports( sAN2 );
setup_adc( ADC_CLOCK_INTERNAL );

set_adc_channel( 2 );

panelvolt=0;
flashtime=20000;

while ( TRUE) {
restart_wdt();

panelvolt = read_adc();

if( !input(art)) {
output_low(light1);
if(calsmode++>=9) calsmode=0;
mode=calsmode;
write_eeprom ( 0, mode );
do{
output_high(uyarlight);
delay_ms(100);
} while(!input(art));
output_low(uyarlight);
}

if( !input(azt)) {
output_low(light1);
if(calsmode–==255)calsmode=8;
mode=calsmode;
write_eeprom ( 0, mode );
do{
output_high(uyarlight);
delay_ms(100);
}while(!input(azt));
output_low(uyarlight);
}

 switch (calsmode) {

     case 0: // ortam aydınlık, ışık sönük, uyarı ışığı yanıp söner
     output_low(light1);
     output_high(uyarlight);
     delay_ms(50);
     output_low(uyarlight);
     //delay_ms(600);
     if( panelvolt < 30 ) calsmode = mode;
     sleep();         
     break;     

     case 1: // ortam karanlık, ışık 3lü flaşör yapar
     output_low(uyarlight);
     output_high(light1);
     delay_ms(20);
     output_low(light1);
     delay_ms(20);
     output_high(light1);
     delay_ms(20);
     output_low(light1);
     delay_ms(20);
     output_high(light1);
     delay_ms(20);
     output_low(light1);
     delay_ms(400);
     break;            

     case 2: // ortam karanlık, ışık flaşör yapar
     output_low(uyarlight);
     output_high(light1);
     delay_ms(10);
     output_low(light1);
     delay_ms(50);
     break;   

     case 3: // ortam karanlık, ışık yanıyor, seviye 1
     lightval = 50;
     isikyak();
     if(flashtime--==0) {
        output_low(uyarlight);
        output_high(light1);
        delay_ms(50);
        flashtime=20000;
     }
     break;

     case 4: // ortam karanlık, ışık yanıyor, seviye 2
     lightval = 80;
     isikyak();
     break;

     case 5: // ortam karanlık, ışık yanıyor, seviye 3
     lightval = 110;
     isikyak();
     break;

     case 6: // ortam karanlık, ışık yanıyor, seviye 4
     lightval = 140;
     isikyak();
     break;

     case 7: // ortam karanlık, ışık yanıyor, seviye 5
     lightval = 170;
     isikyak();
     break;

     case 8: // ortam karanlık, ışık yanıyor, seviye 6
     lightval = 200;
     isikyak();
     break;

     case 9: // SOS sinyali verir.
     output_low(uyarlight);
     yak(10);
     yak(10);
     yak(10);
     yak(60);
     yak(60);
     restart_wdt();
     yak(60);
     yak(10);
     yak(10);
     yak(10);
     sleep();
     break;       


     default: 
     break;
 }

  if( panelvolt > 50 && calsmode!= 1 ) calsmode = 0;
  else calsmode = mode;

}

}

Pages: 1 2 3

One Response to Bicycle Handlebar Light.

  1. yonetici says:

    Build the schematic in Proteus and simulate it to see how it runs.

Trackbacks/Pingbacks

  1. Alien Light Mini | ENDüstri TASarımı
indian porn sexnxxx.cc xvideos Amateur Porn video porno amatoriali filmeporno.top lupoporno film porno gratuit xnxx
video porno देसी सेक्स एचडी पॉर्न ऊपर ऊपर से चुदाई Големи цици filme porno gratis sexohnegrenzen.com popular nudes leaked