Muhamed Mujic Gazetic Elma

Dependencies:   N5110 mbed

main.cpp

Committer:
tim003
Date:
2014-04-28
Revision:
1:1b31b4833884
Parent:
0:2e426771eba7

File content as of revision 1:1b31b4833884:

#include "mbed.h"
 
#include "N5110.h"
 
 
//Analogni ulazi sa dzojstika
AnalogIn    VRx(dp11);
AnalogIn    VRy(dp10);
//Taster sa dzojstika
DigitalIn   SW(dp9);
int x, y;
InterruptIn taster(dp1);

 
  //    VCC,SCE,RST,D/C,MOSI,SCLK,LED
N5110 lcd(dp4,dp24,dp23,dp25,dp2,dp6,dp18);

 
//Digitalni izlaz za aktivaciju LED buffera
DigitalOut enable(dp14);
////LED prikaz
//BusOut  prikazX(dp28,dp6,dp5);
//BusOut  prikazY(dp27,dp26,dp25);
//DigitalOut  prikazSW(dp23);
// 

Timer timer;
int brojac=0;

int x1,y1;

void funk()
{
    if(timer.read_ms() < 1000 && timer.read_ms() > 200)
    {
            
                 
            lcd.clear();
            lcd.refresh();
            timer.reset();
            
    }
    else if(timer.read_ms() >= 1000)
    {
           
            
            x = VRx * 83;
            y = VRy * 47;
            lcd.setPixel(x,y);
            lcd.refresh();
            timer.reset();
     
    }
    
    
    
    
    
}


int main()
{
    //aktivacija LED dioda
//  
    //Aktivacija pull-up otpornika
    SW.mode(PullUp);
    lcd.init();
   
    timer.start();
    taster.rise(&funk);
    int temp = 0;
 
    while(1) {
     temp = 0;
     x1 = VRx * 83;
     y1 = VRy * 47;
     if(lcd.getPixel(x1,y1) != '0')
     {
         temp = 1;
     }    
     lcd.setPixel(x1,y1);
     lcd.refresh();
     wait_ms(100);
     if(temp == 1){
        lcd.clearPixel(x1,y1);
        lcd.refresh(); 
     }
     
    }
}