/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.pde

  • Committer: edam
  • Date: 2011-12-02 19:57:07 UTC
  • Revision ID: edam@waxworlds.org-20111202195707-lko4ap3pfe1jrgd9
renamed code directories and updated the comments in the code

Show diffs side-by-side

added added

removed removed

23
23
 
24
24
/******************************************************************************
25
25
 
26
 
  For a schematic, see propeller-clock.sch.
27
 
 
28
 
  Set up as follows:
29
 
 
30
 
  - a PC fan is wired up to the 12V supply.
31
 
 
32
 
  - the fan's SENSE (tachiometer) pin is connected to pin 2 on the
33
 
    arduino.
34
 
 
35
 
  - the pins 4 to 13 on the arduino should directly drive an LED (the
36
 
    LED on pin 4 is in the centre of the clock face and the LED on pin
37
 
    13 is at the outside.
38
 
 
39
 
  - if a longer hand (and a larger clock face) is desired, pin 4 can
40
 
    be used to indirectly drive (via a MOSFET) multiple LEDs which
41
 
    turn on and off in unison in the centre of the clock.
42
 
 
43
 
  - a button should be attached to pin 3 that grounds it when pressed.
44
 
 
45
 
  Implementation details:
46
 
 
47
 
  - the timing of the drawing of the clock face is recalculated with
48
 
    every rotation of the propeller (for maximum update speed).
49
 
 
50
 
  - pressing the button cycles between display modes
51
 
 
52
 
  - holding down the button for 2 seconds enters "set time" mode. In
53
 
    this mode, the fan must be held still and the LEDs will indicate
54
 
    what number is being entered for each time digit. Pressing the
55
 
    button increments the current digit. Holding it down moves to the
56
 
    next digit (or leaves "set time" mode when there are no more). In
57
 
    order, the digits (with accepted values) are: hours-tens (0 to 2),
58
 
    hours-ones (0 to 9), minutes-tens (0 to 5), minutes-ones (0 to 9).
 
26
Set up:
 
27
 
 
28
 * a PC fan is wired up to a 12V power supply
 
29
 
 
30
 * the fan's SENSE (tachiometer) pin connected to pin 2 on the
 
31
   arduino.
 
32
 
 
33
 * the pins 4 to 13 on the arduino should directly drive an LED (the
 
34
   LED on pin 4 is in the centre of the clock face and the LED on pin
 
35
   13 is at the outside.
 
36
 
 
37
 * if a longer hand (and a larger clock face) is desired, pin 4 can be
 
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
 
 
41
 * a button should be attached to pin 3 that grounds it when pressed.
 
42
 
 
43
Implementation details:
 
44
 
 
45
 * for a schematic, see project/propeller-clock.sch.
 
46
 
 
47
 * the timing of the drawing of the clock face is recalculated with
 
48
   every rotation of the propeller.
 
49
    
 
50
 * a PC fan actually sends 2 tachiometer pulses per revolution, so the
 
51
   software skips every other one. This means that the clock may
 
52
   appear upside-down if started with the propeller in the wrong
 
53
   position. You will need to experiment to dicsover the position that
 
54
   the propeller must be in when starting the clock.
 
55
    
 
56
Usage instructions:
 
57
 
 
58
 * pressing the button cycles between variations of the current
 
59
   display mode.
 
60
  
 
61
 * pressing and holding the button for a second cycles between display
 
62
   modes (e.g., analogue and digital).
 
63
 
 
64
 * pressing and holding the button for 5 seconds enters "time set"
 
65
   mode. In this mode, the following applies:
 
66
    - the field that is being set flashes
 
67
    - pressing the button increments the field currently being set
 
68
    - pressing and holding the button for a second cycles through the
 
69
      fields that can be set
 
70
    - press and holding the button for 5 seconds to finish
59
71
 
60
72
******************************************************************************/
61
73