/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: 2011-11-17 13:05:46 UTC
  • Revision ID: edam@waxworlds.org-20111117130546-by4v2vm98emidlrk
updated propeller-clock code, added GPL text and renamed fan-test
- made basic_statement::step() protected, for use by query and command only
- moved basic_statement::operator<<() to command and query instead; one needs to accept sqlite::exec, the other doesn't
- added tests for query::operator<<()
- added code to invlaidate in-progress queries during any transaction rollbacks (currently segfaults in basic_statement::finalize())
- added new sqlite_error constructor that obtains a full error message
- implemented database::database_mutex_guard class
- swapped command's step mutex in favour of the database mutex

Show diffs side-by-side

added added

removed removed

1
 
void setup()
2
 
{
3
 
        // set up output pins (4 to 13) for the led array
4
 
        for( int a = 4; a < 14; a++ )
5
 
                pinMode( a, OUTPUT );
6
 
 
7
 
        // set up mode-switch button on pin 3
8
 
        pinMode( 3, INPUT );
9
 
        digitalWrite( 3, HIGH );
10
 
 
11
 
        // pink LED on
12
 
        digitalWrite( 13, HIGH );
13
 
}
14
 
 
15
 
// turn an led on/off
16
 
void ledOn( int pin, bool on )
17
 
{
18
 
        // pin 4 needs to be inverted (it's driving a PNP)
19
 
        if( pin == 4 ) on = !on;
20
 
 
21
 
        digitalWrite( pin, on? HIGH : LOW );
22
 
}
23
 
 
24
 
void loop()
25
 
{
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
 
}