Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 1:7401cb4ec3f3, committed 2011-11-07
- Comitter:
- Nurbol
- Date:
- Mon Nov 07 16:42:27 2011 +0000
- Parent:
- 0:6e7bc9e7034a
- Commit message:
Changed in this revision
WattBob_TextLCD.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/WattBob_TextLCD.lib Tue Oct 25 13:53:47 2011 +0000 +++ b/WattBob_TextLCD.lib Mon Nov 07 16:42:27 2011 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/jimherd/code/WattBob_TextLCD/#3b26cd028e85 +http://mbed.org/users/jimherd/code/WattBob_TextLCD/#020722c18a8b
--- a/main.cpp Tue Oct 25 13:53:47 2011 +0000 +++ b/main.cpp Mon Nov 07 16:42:27 2011 +0000 @@ -7,31 +7,60 @@ -AnalogIn sensor(p15); -DigitalOut led(LED1); +AnalogIn sensor1(p15); +AnalogIn sensor2(p16); +AnalogOut valueLED1(p18); +DigitalOut valueLED2(p25); +DigitalOut led1(LED1); +DigitalOut led2(LED2); +DigitalOut clk(p26); + + MCP23017 *par_port; // pointer to 16-bit parallel I/O object WattBob_TextLCD *lcd; // pointer to 2*16 chacater LCD object + + int main() { - +valueLED1=0; +valueLED2=0; +clk=0; par_port = new MCP23017(p9, p10, 0x40); // initialise 16-bit I/O chip lcd = new WattBob_TextLCD(par_port); // initialise 2*26 char display par_port->write_bit(1,BL_BIT); + + + + while(1) { - sensor.read(); + clk = !clk; + wait(0.01); + + sensor1.read(); + sensor2.read(); - if(sensor > 0.5) { - led = 1; - + if(sensor1 > 0.5) { + led1 = 1; + valueLED1 = 1; + } + else if(sensor1 < 0.5){ + led1 = 0; + valueLED1 = 0; + } + + + if(sensor2 > 0.5) { + led2 = 1; + valueLED2 = 1; } else{ - led = 0; - + led2 = 0; + valueLED2 = 0; } - lcd->printf("%f\n",sensor.read()); + lcd->printf("%f\n",sensor2.read()); } }