tim007 tim007
/
LV8-Grupa6-Tim007-zad3
Armin Klačar Josip Kvesić
main.cpp
- Committer:
- tim007
- Date:
- 2014-05-08
- Revision:
- 0:3c58a06d8217
File content as of revision 0:3c58a06d8217:
#include "mbed.h" #include "N5110.h" N5110 lcd(dp4,dp24,dp23,dp25,dp2,dp6,dp18); Serial pc(USBTX, USBRX); DigitalOut enable (dp14); int x=0; int y=0; void readwrite() { if(!pc.readable()) return; char c = pc.getc(); if (c=='1') { lcd.clear(); lcd.setXYAddress(x=0,y=0); } else if (c=='2') { ++y; if(y==6) y=0; lcd.setXYAddress(x=0,y); } else if (c=='3') { x-=6; if(x<0) {y--; x = 77;if(y<0) y=0; } lcd.setXYAddress(x,y); lcd.printChar(' '); lcd.setXYAddress(x,y); } else if(c >= 32 && c < 126) { if(x>77) { x=0; y++; if (y==6) y=0; lcd.setXYAddress(x,y); } lcd.printChar(c); x+=6; } } int main() { enable = 1; lcd.init(); lcd.setXYAddress(x,y); pc.attach(readwrite); while(1); }