tim008 tim008
/
lv8_Tim008_zad3
Ilvana Brankovic Emina Muharemovic
Diff: main.cpp
- Revision:
- 0:c12be7f2bae2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu May 08 14:07:03 2014 +0000 @@ -0,0 +1,89 @@ +#include "mbed.h" +#include "N5110.h" + +N5110 lcd(dp4,dp24,dp23,dp25,dp2,dp6,dp18); + +Serial pc( USBTX,USBRX); + + +#define delete '#' +#define backspace '*' +#define enter '&' + +int x=0; +int y=0; + + +char unesen; + +int main() { + lcd.init(); + lcd.setXYAddress(0,0); + while(1) { + + unesen=pc.getc(); + if(unesen=='#') + { + lcd.clear(); + lcd.refresh(); + lcd.setXYAddress(0,0); + x=0; + y=0; + } + else if(unesen=='&') + { + if(x==83) + { + x=0; + } + y=y+1; // ili je y+1 + + if(y==48) + { + y=0; + } + lcd.setXYAddress(0,y); + + } + else if(unesen=='*') + { + if(x>6) + { + for(int i=y-1;i<y;i++) + { + for(int j=x-6;j<x;j++) + { + lcd.clearPixel(j,i); + } + } + x=x-6; + lcd.setXYAddress(x,y); + } + else + { + + } + + + + } + else + { + lcd.printChar(unesen); + x=x+6; + if(x==83) + { + x=0; + y=y+1; + } + //adresa da li se kod printcahr stalno mijenja + // da li sam vidi imal mjesta da upise taj svoj char + } + } + + + + + + +}