Haris Imamovic
/
LV06_Grupa03_Tim07_Zad02
Haris Imamovic
Revision 0:f36af9f8548c, committed 2016-04-25
- Comitter:
- 2016US_HarisImamovic
- Date:
- Mon Apr 25 19:39:40 2016 +0000
- Commit message:
- LV 6 - US - Grupa 3 - Tim 7
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 f36af9f8548c main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Apr 25 19:39:40 2016 +0000 @@ -0,0 +1,41 @@ +#include "mbed.h" +#define dp23 P0_0 + +// LED pinovi +DigitalOut enable(dp14); +BusOut diode(dp23, dp24, dp25, dp26, dp27, dp5, dp6, dp28); + +// veza sa PC +Serial terminal(USBTX, USBRX); + +// char decode[8] = {127, 63, 31, 15, 7, 3, 1, }; + + +int main() { + enable = 0; + diode = 0; + + /* + char unos('X'); // trenutno undefined vrijednost unosa + + while(1) { + unos = terminal.getc() - '0'; + diode = 1 << unos; + break; + } + */ + + // Varijanta koja mijenja stanje na diodama samo ako je doslo do promjene + char novi(255), stari(255); + + while(1) { + if(terminal.readable()) { + novi = terminal.getc() - '0'; + + if( novi < 8 && novi != stari ) { + diode = 1 << novi; + stari = novi; + } + } + } +}
diff -r 000000000000 -r f36af9f8548c mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Apr 25 19:39:40 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/082adc85693f \ No newline at end of file