/elec/propeller-clock

To get this branch, use:
bzr branch http://bzr.ed.am/elec/propeller-clock

« back to all changes in this revision

Viewing changes to src/propeller-clock.ino

  • Committer: edam
  • Date: 2012-01-14 16:54:49 UTC
  • Revision ID: edam@waxworlds.org-20120114165449-dkgjun2pb5tr9g2a
updated schematic (switched to PNP) and added info about transistors

Show diffs side-by-side

added added

removed removed

35
35
   13 is at the outside.
36
36
 
37
37
 * if a longer hand (and a larger clock face) is desired, pin 4 can be
38
 
   used to indirectly drive a transistor which in turn drives several
39
 
   LEDs that turn on anf off in unison in the centre of the clock.
 
38
   used to indirectly drive (via a MOSFET) multiple LEDs which turn on
 
39
   and off in unison in the centre of the clock.
40
40
 
41
41
 * a button should be attached to pin 3 that grounds it when pressed.
42
42
 
43
 
 * A DS1307 remote clock is connected via I2C on analog pins 4 and 5.
44
 
 
45
43
Implementation details:
46
44
 
47
 
 * for a schematic, see ../project/propeller-clock.sch.
 
45
 * for a schematic, see project/propeller-clock.sch.
48
46
 
49
47
 * the timing of the drawing of the clock face is recalculated with
50
48
   every rotation of the propeller.
69
67
    - pressing the button increments the field currently being set
70
68
    - pressing and holding the button for a second cycles through the
71
69
      fields that can be set
72
 
    - pressing and holding the button for 5 seconds sets the time and
73
 
      exits "time set" mode
 
70
    - press and holding the button for 5 seconds to finish
74
71
 
75
72
******************************************************************************/
76
73
 
77
74
 
78
75
#include <Bounce.h>
79
 
#include <DS1307.h>
80
 
#include <Wire.h>
81
76
 
82
77
//_____________________________________________________________________________
83
78
//                                                                         data
309
304
        // set up mode-switch button on pin 3
310
305
        pinMode( 3, INPUT );
311
306
 
312
 
        // get the time from the real-time clock
313
 
        int rtc_data[ 7 ];
314
 
        RTC.get( rtc_data, true );
315
 
        time_hours = rtc_data[ DS1307_HR ];
316
 
        time_minutes = rtc_data[ DS1307_MIN ];
317
 
        time_seconds = rtc_data[ DS1307_SEC ];
318
 
 
319
307
        // serial comms
320
308
        Serial.begin( 9600 );
321
309
}