Ilvana Brankovic Emina Muharemovic

Dependencies:   N5110 mbed

main.cpp

Committer:
tim008
Date:
2014-05-08
Revision:
0:c12be7f2bae2

File content as of revision 0:c12be7f2bae2:

#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
        }
        }
        
            
            
       
       
    
}