Go Down

Topic: This annoying alarm clock project - lack of inputs. (Read 3444 times) previous topic - next topic

majenko

You are quite correct.  Gray Code (as it is known) is a minimum of 2 bits wide.

Graynomad

They could be 1-bit if you don't care about direction. Otherwise you're right, 2 or more is needed.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

florinc

Quote
A rotary switch - to call it - would need two inputs, right?

The rotary encoder I use can replace with two switches. Each click rotating the encoder is equivalent to a button push.
Actually, the second version of the same clock
http://timewitharduino.blogspot.ca/2011/08/illyclock-revisited-minimalist-look.html
uses just one button to simulate an encoder that rotates one way.

lost_and_confused

Flornic,

I shall have to work out how to talk to you  directly.

My "clock project" is coming on quite well.  Though "Liudr" is being painful with his slow replies; not helping.

Anyway, when I get time to work out how to get in touch with you directly - or not via the forum -  I shall.

Some of my clock functions are "out there" and are actually useful.  Well, to me anyway.

;)


majenko


They could be 1-bit if you don't care about direction. Otherwise you're right, 2 or more is needed.

______
Rob


A 1-bit rotary encoder has a special name - it's called a "button" :P

Graynomad

Rob Gray aka the GRAYnomad www.robgray.com

Riva

#36
Jun 28, 2012, 12:46 pm Last Edit: Jun 28, 2012, 01:06 pm by Riva Reason: 1
I'm not sure what you want all these buttons to do with regard to your clock but I built a clock that uses this encoder using only 3 I/O pins to set hours, minutes, day, month, year, day of week & daylight saving.

winner10920

That infrared idea sounds like the easiest expansion, you can get a remote with a hundred buttons and. All the arduino uses is one pin,
or have it that after a certain setup period the buttons change function

The Clever Monkey


But they can't be ONE bit can they?


No, they can be one bit if all you want is rotation velocity without direction or a known start point.
I yield() for co-routines.

lost_and_confused

Flornic,

Not wanting to sound difficult, could you attach those files?

Are they "libraries"?

I actually may need those functions - it is amazing how many new functions I have thought of for my clock.


florinc

Quote
could you attach those files

Just copy and paste them into text files (with notepad, if you are on windows). Name the files CButton.h and CButton.cpp respectively. It really does not get simpler than this.
Quote
Are they "libraries"?

I don't think so (at least not according to my definition for library). They are just source files defining a C++ class. You use them as you would use the DS1307 "library": include the header in your own PDE, instantiate the class (create object), then use it the instance to call functions. As I said, follow the way the DS1307 class is used.

lost_and_confused

Florinc,

"It really does not get simpler than this"

Yeah, welll, no comment.

I know jack about C and am quite amazed how much I have "done" with the code.

I shall get the two files as you said and talk to someone face to face this weekend and maybe learn how it all works.

But thanks.

lost_and_confused

Another question:

Does anyone actually have/use this code?  As in the original.

The code has provisions for 4 alarms and there are four modes:
Week day,
Week end,
Daily,
Once.

Now this "ONCE" mode has me stumped.

Where - in the code - is the alarm "Cleared" once the given time is passed?

Why I am asking is that I have played with this a couple of times and found the alarm is still set as active.

It doesn't re-trigger in 24 hours time, but I suspect it will trigger again.
I actually think it did once trigger 24 hours later.

In my modified code there are symbols indicating if an alarm is "active".  That is done by the "DOW" byte set.  That is read from the EEOROM.

I have found in the code where the "DOW" is cleared in the program, but it doesn't clear the DOW in the EEPROM.

So to me it implies that the alarm is going to activate again at some time.  I am suspicious it would be in 7 days timme, bu tit could be 24 hours too.   Not enough testing happened as yet.

Anyone?

lost_and_confused

Flornic,

So how do I "use" these classes?

Do I have to "include" them or do I actually have to put the code in my sketches?


florinc

Take a look at the code (file SillyClock.pde):
http://code.google.com/p/wiseclock2/downloads/detail?name=SillyClock.zip&can=2&q=#makechanges
Cut just the alarm clock logic, with the state machine and stuff. The hardware-specific part may not be suitable for your hardware (unless you used the exact schematic I used).

Go Up