![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Novo
Fork of LukaIElmir by
main.cpp
- Committer:
- tim003
- Date:
- 2014-06-02
- Revision:
- 6:dd675b967b60
- Parent:
- 5:654e3398c1ef
File content as of revision 6:dd675b967b60:
#include "mbed.h" #include "DotMatrix.h" #include "MatrixSPI.h" //MatrixSPI mspi; DotMatrix d; Serial pc(USBTX, USBRX); void Meni() { pc.printf("1 - promjena teksta \n2 - promjena moda\n3 - promjena osvjetljenja\n4 - ukljuci prikaz teksta\n4 - iskljuci prikaz teksta\n6 - live input\nUnos: "); char komanda = pc.getc(); if(komanda == '1') { pc.printf ("\nUnesite novi tekst: "); string line; char c = pc.getc(); while (c != '\n') { line.push_back(c); c = pc.getc(); } d.PromijeniRecenicu(line); } else if (komanda == '2') { char c; do { pc.printf("1 - scroll \n2 - slovo po slovo\n0 - povratak na glavni meni\nMod: "); c = pc.getc(); if(c == '1') d.PromijeniMod(scroll); else if(c == '2') d.PromijeniMod(char_by_char); } while(c < '0' || c > '2'); } else if (komanda == '3') { char c; do { pc.printf("Unesite broj od 0 do 9 za promjenu osvjetljenja: "); c = pc.getc(); if(c >= '0' && c <= '9') d.setIntensity((c - '0')/ 10.0); } while(c < '0' || c > '9'); } else if (komanda == '4') { d.turnON(); } else if (komanda == '5') { d.turnOFF(); } else if (komanda == '6') { char c; while ((c = pc.getc()) != '\n') d.displaySingleChar(c); d.refresh(); } else pc.printf ("Unos nije ispravan!!!\nPonovite unos: "); } void test1(){ d.displaySingleChar('L'); wait(0.33); d.displaySingleChar('U'); wait(0.33); d.displaySingleChar('K'); wait(0.33); d.displaySingleChar('A'); wait(0.33); d.displaySingleChar('i'); wait(0.33); d.displaySingleChar('e'); wait(0.33); d.displaySingleChar('l'); wait(0.33); d.displaySingleChar('m'); wait(0.33); d.displaySingleChar('i'); wait(0.33); d.displaySingleChar('e'); wait(0.33); d.displaySingleChar('.'); wait(0.33); d.displaySingleChar(','); wait(0.33); d.displaySingleChar('Ć'); wait(0.33); d.displaySingleChar('L'); wait(0.33); for(int i = 0; i < 10; i++) { char c = (i%2? 'M' : 0); d.displaySingleChar(c); wait(0.5); } } void test2(){ d.setChar('L',1); d.refresh(); wait(0.33); d.setChar('U',1); d.refresh(); wait(0.33); d.setChar('K',1); d.refresh(); wait(0.33); d.setChar('A',1); d.refresh(); wait(0.33); d.setChar('i',1); d.refresh(); wait(0.33); d.setChar('e',1); d.refresh(); wait(0.33); d.setChar('l',1); d.refresh(); wait(0.33); d.setChar('m',1); d.refresh(); wait(0.33); d.setChar('i',1); d.refresh(); wait(0.33); d.setChar('e',1); d.refresh(); wait(0.33); d.setChar('.',1); d.refresh(); wait(0.33); d.setChar(',',1); d.refresh(); wait(0.33); d.setChar(0,1); d.refresh(); wait(0.33); d.setChar('L',1); d.refresh(); wait(0.33); for(int i = 0; i < 60; i++) { d.setChar('M', (i%16)-8); d.refresh(); wait(0.25); } } void test3(){//test recenica d.PromijeniRecenicu("Luka bio ovdje"); bool t = false; for(int i = 0; i < d.recenica.size(); i++){ d.displaySingleChar(d.recenica[i]); wait(t ? d.brzina_ms*1000 : 0.25); } } int main() { d.PromijeniMod(char_by_char); d.turnON(); for(int i = 0; i < d.recenica.size(); i++) { pc.putc(d.recenica[i]); } pc.putc('\n'); //enable = 1; /*t.attach(&funkcija, 0.01); setup ();*/ Meni(); while(1) { } }