pic16f628a bike light controller-thought it would be easy...


Closed Thread
Results 1 to 2 of 2
  1. #1
    Caddydan's Avatar
    Caddydan Guest

    Talking pic16f628a bike light controller-thought it would be easy...

    Newbie here, I am trying to build a bike light controller to control the intensity of my homemade bike lights. What I am trying to accomplish is this:
    1 Press button one time-turn light on to full intensity using hpwm.
    2 Press button again(any time after first press)-lower intensity, lower pulse width.
    3 Press button again-lowest intensity. Maybe 50% duty cycle.
    4 Press and hold button for two seconds-light off.

    I am having a hard time finding what commands to use-COUNT, RCTIME, lots of IF THEN and GOTO. It seems I can get close but no cigar. I have been using the PBP user manual and Chuck Hellebuyck's book Programming Pic Microcontrollers with PicBasic. I just do not have any programming experience to reference.

    I am using PBP, Microcode Studio Plus, Picallw and the P16PRO40 programmer.
    Note to other newbies: if your programmer has problems, try another computer-many manhours to make this observation.

    Thanks to all for viewing and any help or direction you could provide.

    Caddydan

  2. #2
    Bill H's Avatar
    Bill H Guest


    Did you find this post helpful? Yes | No

    Default light controller

    You have two things to keep track of not counting the HPWM portion.
    1.) how many times the button is pressed.
    2.) how long it is pressed.

    Darrel Taylor has a great example of doing #2 in the memory button thread.

    http://www.picbasic.co.uk/forum/showthread.php?t=3291

    Here's how I see it being done.


    check the button
    is the button being held down?
    yes or no
    if yes, turn if off.
    if no, is the light on full?
    yes or no
    if yes, dim it some
    if no, is it 1st level dimmed?
    yes or no
    if yes, dim it some more
    if no, is it second level dimmed?
    yes or no
    if yes, turn it back on full
    if no, dim it some more


    Bill H
    Last edited by Bill H; - 12th February 2006 at 21:56.

Similar Threads

  1. Temperature Controller using PIC16F628A
    By bentech4u in forum mel PIC BASIC
    Replies: 34
    Last Post: - 14th March 2010, 19:44
  2. Help Pic16f628a
    By gadelhas in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 26th August 2008, 23:22
  3. LED Light Controller
    By lightwaveengine in forum mel PIC BASIC
    Replies: 0
    Last Post: - 18th June 2006, 15:46

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts