Site Navigation

Your Account

Choose Language

Anything programming related to the Hexbright

34 Questions View all

Features I will try to combine: Questions.

Features

Modes that I would like to include in my program:

Steady:

  • Assuming that 0 degrees = vertical with lens down.
  • Activates with one short click from any mode including off.
    • If >= 90 degrees, 1000 //how do I specify a position from level to vertical (lens up)?
    • If 10 to 90 degrees, 500 //how do I specify a position between lens down and level?
    • If 0 to 10 degrees, 1 //how do I define the position of vertical (lens down)?
  • turns off with one short click.

Blink:

  • Activates with two short clicks from any mode including off.
    • If >= 90 degrees, fast strobe, max bright.
    • If 10 to 90 degrees, medium flash, max bright // suitable for bicycles.
    • If 1 to 10 degrees, slow flash, max bright // beacon mode
  • Off with one short click

Battery Level:

  • Activates with three short clicks from any mode including off.
    • 85 to 90 % = Green LED flash twice
    • 50 to 85 % = Green then red flash
    • 15 to 50 % = Red LED flash twice
    • 1 to 15 % = Red led flash four times.
  • After flash, pause for 3 seconds, repeat once then return to prior mode, including off.

SOS:

  • Activates with long click (3 seconds) from any mode including off.
  • Flashes SOS, max bright
    • Pause 3 seconds, repeat

*Off with one short click

Questions

So, those are the features I want to combine into one program. Since I am using this as an opportunity to teach myself how to program, this project will take a while and will be the source of many questions.

If you have any idea, suggestions, questions or general comment, jump in. And Thanks.

Initial questions:

  1. What programing language does the HexBright use?
  2. Where can I find a beginner's guide to programming for this language?
  3. Where can I find a list of perimeters, variables and commands unique to the HexBright?
  4. If I wanted to use someone's code as a starting point for something I am working on but I do not want to pollute their original code with my beginner's flailing, how do I do this in Git?
    • Clone?
    • Copy?
    • Fork?
  5. In Git should I start a repository while the code is still in an unusable state?
Answer this question I have this problem too

Is this a good question?

Score 0
Add a comment

1 Answer

Most Helpful Answer

1. C++

2. Anywhere that sells books or on the web.

3-5. Start with dhiltonp's Hexbright library It is the most developed API to work from and will keep you from having to directly interface with hardware. This is a very recommended approach to someone learning embedded programming in C++. You should fork the above mentioned repo which will give you a place to push your unstable code. If you ever have anything worth merging dhiltonp will be happy to pull and merge it.

Also, my up_n_down program does much of what you describe above. Check it out in the above mentioned repo.

Also, join us on IRC at #hexbright. It's probably the best place to have development related discussions.

Was this answer helpful?

Score 2

Comments:

Good summary. I'd like to add a few things;

1. When programming, focus on small independent steps. The smaller steps you can break things down into, the easier it will be for you. You have done that well with the first two modes, but not the last two.

2. hexbright.h has a list of all available methods; you should be able to find something that will help you determine the flashlights orientation in there (I'm not telling you what it is until you can tell me you've looked and can't find it).

3. Upload your code to github, jump on IRC, and ask for feedback.

You should be able to write the first couple of modes in a week or two. The 3rd mode will require library modifications, save it for last, and jump on IRC to talk about how to do it. I'll be happy to help you figure it out.

by

@ Whitney: Your up_n_down app is brilliant! It is what I have been using since day two and I would be content with it if I were not going to try my hand and tying together my own program. Yours was the code I was thinking of forking. I just wanted to make sure that if I did, none of the crap that will ooze out of my early attempts finds its way back to your source.

by

@ David: Thanks for the advice re well defined bite-sized sections. And also all your work on hexbright.h. [hmmm, answer to orientation question static unsigned char get_tilt_orientation(); maybe..]

by

Add a comment

Add your answer

Sean Havins will be eternally grateful.
View Statistics:

Past 24 Hours: 0

Past 7 Days: 0

Past 30 Days: 0

All Time: 237