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 0:1f6f7de83adc, committed 2014-03-24
- Comitter:
- tim010
- Date:
- Mon Mar 24 10:55:09 2014 +0000
- Commit message:
- PAI - LV4 - GRUPA2 - TIM010
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 1f6f7de83adc main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Mar 24 10:55:09 2014 +0000 @@ -0,0 +1,30 @@ +#include "mbed.h" + +using namespace std; + +BusOut segments(dp2, dp1, dp28, dp6, dp5, dp27, dp26); +BusOut digit(dp23, dp24, dp25); +DigitalOut decimal_point(dp4); +AnalogIn voltage(dp9); + + +int predefined_segments[10] = {0x01, 0x4f, 0x12, 0x06, 0x4c, 0x24, 0x20, 0x0f, 0x00, 0x04}; + +void display(float vtg) +{ + + int digits[3] = {(int)(vtg / 100) % 10, (int)(vtg / 10) % 10, (int)(vtg) % 10}; + for(int i = 1; i <= 4; i = i * 2) { + segments = predefined_segments[digits[i / 2]]; + digit = ~i; + decimal_point = (i == 1) ? 0 : 1; + wait_ms(1); + } +} + +int main() +{ + while(1) { + display(voltage * 3.3 * 100); + } +}
diff -r 000000000000 -r 1f6f7de83adc mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Mar 24 10:55:09 2014 +0000 @@ -0,0 +1,1 @@ +http://world3.dev.mbed.org/users/mbed_official/code/mbed/builds/824293ae5e43 \ No newline at end of file