Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 # include "mbed.h" 00002 # include "N5110.h" 00003 # include <vector> 00004 // Deklaracija LCD objekta 00005 // N5110 lcd (VCC ,SCE ,RST ,D/C,MOSI ,SCLK , LED ) 00006 N5110 lcd (dp4 ,dp24 ,dp23 ,dp25 ,dp2 ,dp6 , dp18 ); 00007 // Digitalni izlaz za deaktivaciju LED buffera 00008 //DigitalOut enable ( dp14 ); 00009 00010 AnalogIn VRx ( dp11 ); 00011 AnalogIn VRy ( dp10 ); 00012 00013 DigitalIn SW( dp17 );// Taster sa dzojstika 00014 DigitalIn taster1(dp1); 00015 00016 00017 00018 00019 bool taster_jedan(){ 00020 bool pricinut = false; 00021 int i=0; 00022 while(taster1) i++; 00023 if(i>5000) pricinut=true; 00024 return pricinut; 00025 } 00026 00027 struct Koordinata { 00028 int x,y; 00029 Koordinata(int x, int y) : x(x), y(y) {} 00030 00031 }; 00032 00033 void setCursor(int x, int y, std::vector<Koordinata> &v) { 00034 if(x<83 && y<47 && x>0 && y>0){ 00035 lcd.clear(); 00036 for(int i(0); i<v.size(); i++) { 00037 lcd.setXYAddress(0,0); 00038 lcd.setPixel(v[i].x,v[i].y); 00039 } 00040 lcd.setXYAddress(0,0); 00041 lcd.setPixel(x,y); 00042 lcd.setPixel(x+1,y); 00043 lcd.setPixel(x-1,y); 00044 lcd.setPixel(x,y+1); 00045 lcd.setPixel(x,y-1); 00046 lcd.refresh(); 00047 } 00048 } 00049 00050 vector<Koordinata> tacke; 00051 void regulisiTaster(int x, int y) { 00052 for(int i(0); i<1000; i++){ 00053 if(taster_jedan()) {tacke = vector<Koordinata>(); 00054 return;} 00055 } 00056 tacke.push_back(Koordinata(x, y)); 00057 } 00058 00059 int main () { 00060 lcd.setXYAddress(0,0); 00061 lcd.init ();// inicijalizacija displeja 00062 setCursor(42,24,tacke); 00063 00064 while (1) { 00065 int x = VRx*83, y = VRy*47; 00066 if(taster_jedan()) regulisiTaster(x,y); 00067 setCursor(x, y, tacke); 00068 00069 } 00070 }
Generated on Sat Jul 23 2022 10:36:59 by
1.7.2