/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 test/phantom-button-presses/main.ino

  • Committer: edam
  • Date: 2012-02-15 22:34:20 UTC
  • Revision ID: edam@waxworlds.org-20120215223420-gsp7ywxbp02u3u3x
added part no.s

Show diffs side-by-side

added added

removed removed

13
13
}
14
14
 
15
15
// turn an led on/off
16
 
void ledOn( int pin, bool on )
 
16
void ledOn( int num, bool on )
17
17
{
 
18
        if( num < 0 || num > 9 ) return;
 
19
 
 
20
        // convert to pin no.
 
21
        num += 4;
 
22
 
18
23
        // pin 4 needs to be inverted (it's driving a PNP)
19
 
        if( pin == 4 ) on = !on;
 
24
        if( num == 4 ) on = !on;
20
25
 
21
 
        digitalWrite( pin, on? HIGH : LOW );
 
26
        digitalWrite( num, on? HIGH : LOW );
22
27
}
23
28
 
24
29
void loop()
25
30
{
26
 
        bool on = digitalRead( 3 )? true : false;
27
 
        for( int a = 4; a < 12; a++ )
28
 
                ledOn( a, false );
29
 
        ledOn( 12, on );
30
 
        delay( 100 );
 
31
        bool on = true;//digitalRead( 3 )? true : false;
 
32
        for( int a = 0; a < 9; a++ )
 
33
                ledOn( a, on );
 
34
        delay( 1000 );
31
35
}