Pages: 1 2 [3]   Go Down
Author Topic: This annoying alarm clock project - lack of inputs.  (Read 2876 times)
0 Members and 1 Guest are viewing this topic.
UK
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4153
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8473
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

0
Offline Offline
Edison Member
*
Karma: 8
Posts: 1411
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Oz
Offline Offline
God Member
*****
Karma: 4
Posts: 708
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

smiley-wink

Logged

UK
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4153
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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" smiley-razz
Logged

Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8473
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Or maybe a "knob" smiley

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Norfolk UK
Offline Offline
Edison Member
*
Karma: 66
Posts: 2479
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: June 28, 2012, 06:06:14 am by Riva » Logged

There is no such thing as a stupid question but there are a lot of inquisitive idiots.

Offline Offline
Edison Member
*
Karma: 5
Posts: 1730
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Canada
Offline Offline
Full Member
***
Karma: 0
Posts: 246
Code Monkey
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

I yield() for co-routines.

Oz
Offline Offline
God Member
*****
Karma: 4
Posts: 708
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

0
Offline Offline
Edison Member
*
Karma: 8
Posts: 1411
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Oz
Offline Offline
God Member
*****
Karma: 4
Posts: 708
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Oz
Offline Offline
God Member
*****
Karma: 4
Posts: 708
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Oz
Offline Offline
God Member
*****
Karma: 4
Posts: 708
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?

Logged

0
Offline Offline
Edison Member
*
Karma: 8
Posts: 1411
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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).
Logged

Pages: 1 2 [3]   Go Up
Jump to: