Novo

Dependencies:   mbed

Fork of LukaIElmir by tim003 tim003

Files at this revision

API Documentation at this revision

Comitter:
tim003
Date:
Mon Jun 02 15:35:11 2014 +0000
Parent:
5:654e3398c1ef
Commit message:
LIE26

Changed in this revision

DotMatrix.cpp Show diff for this revision Revisions of this file
DotMatrix.h Show annotated file Show diff for this revision Revisions of this file
Mapa.h Show diff for this revision Revisions of this file
Znak.h Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/DotMatrix.cpp	Mon May 26 18:28:21 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-#include "DotMatrix.h"
-#include "MatrixSPI.h"
-
-void DotMatrix::refresh(){
-    for(int i = 0; i < 8; i++)
-    {
-        spi.sendCol(i, buffer[i]); 
-        buffer[i] = 0;  
-    }
-}
-
-void DotMatrix::setIntensity(float jacina){
-    if(jacina <= 0){
-        spi.turnOFF();
-        turnedON = false;   
-        
-        
-    } else if(jacina >= 0.98){
-        if(!turnedON){ 
-            spi.turnON();
-            turnedON = true;
-        }
-        
-        spi.sendSingle(MatrixSPI::intensity, 0x0f);
-    } else {
-        if(!turnedON){ 
-            spi.turnON();
-            turnedON = true;
-        }
-        
-        int temp =  jacina*0x0f;
-        spi.sendSingle(MatrixSPI::intensity, temp);
-    } 
-}
-
-void DotMatrix::attach()
-{
-    ticker.detach();
-    if(mod == scroll)
-    {
-        ticker.attach(this, &DotMatrix::prikaziScroll, brzina_ms/8);
-    } else if(mod == char_by_char){
-        ticker.attach(this, &DotMatrix::prikaziCBC, brzina_ms);
-    }
-}
-
-void DotMatrix::setSpeed_ms(int ms)
-{
-    ticker.detach();
-    
-    attach();   
-       
-}
-
-void DotMatrix::turnON(){
-    if(!turnedON){
-        spi.turnON();
-        turnedON = true;
-        
-        attach();   
-    }
-}
-
-void DotMatrix::turnOFF(){
-    if(turnedON){
-        spi.turnOFF();
-        turnedON = false;
-        
-        ticker.detach();   
-    }   
-}
\ No newline at end of file
--- a/DotMatrix.h	Mon May 26 18:28:21 2014 +0000
+++ b/DotMatrix.h	Mon Jun 02 15:35:11 2014 +0000
@@ -1,20 +1,89 @@
 #include "mbed.h"
 #include "MatrixSPI.h"
 #include <string>
-#include <vector>
-#include "Znak.h"
+
 #ifndef DOTMATRIX_H
 #define DOTMATRIX_H
 
 enum ModPrikazivanja{scroll, char_by_char, live_input};
+const char znakovi[66][6] =
+{
+    {0, 0x7e, 0x11, 0x11, 0x7e, 0},//A
+    {0, 0x7e, 0x49, 0x49, 0x36, 0}, //B
+    {0, 0x3e, 0x41, 0x41, 0x22, 0}, //C
+    {0, 0x7f, 0x41, 0x41, 0x3e, 0}, //D
+    {0, 0x7f, 0x49, 0x49, 0x41, 0}, //E
+    {0, 0x7f, 0x09, 0x09, 0x01, 0}, //F
+    {0x3e, 0x41, 0x51, 0x32, 0x70, 0}, //G
+    {0, 0x7f, 0x08, 0x08, 0x7f, 0}, //H
+    {0, 0x41, 0x7f, 0x41, 0, 0}, //I
+    {0, 0x21, 0x41, 0x41, 0x3f, 0}, //J
+    {0, 0x7f, 0x08, 0x14, 0x63, 0}, //K
+    {0, 0x7f, 0x40, 0x40, 0x40, 0}, //L
+    {0x7f, 0x02, 0x0c, 0x02, 0x7f, 0}, //M
+    {0x7f, 0x04, 0x08, 0x10, 0x7f, 0}, //N
+    {0, 0x3e, 0x41, 0x41, 0x3e, 0}, //O
+    {0, 0x7f, 0x09, 0x09, 0x06, 0}, //P
+    {0x3e, 0x41, 0x51, 0x3e, 0x40, 0}, //Q
+    {0, 0x7f, 0x09, 0x09, 0x76, 0}, //R
+    {0, 0x26, 0x89, 0x89, 0x32, 0}, //S
+    {0x03, 0x01, 0x7f, 0x01, 0x03, 0},  //T
+    {0x1f, 0x20, 0x40, 0x40, 0x20, 0x1f},  //U
+    {0x1f, 0x20, 0x40, 0x20, 0x1f, 0}, //V
+    {0x3f, 0x40, 0x38, 0x40, 0x3f, 0}, //W
+    {0x63, 0x14, 0x08, 0x14, 0x63, 0}, //X
+    {0x07, 0x08, 0x70, 0x08, 0x07, 0}, //Y
+    {0x61, 0x51, 0x49, 0x45, 0x43, 0}, //Z
+    {0, 0x20, 0x54, 0x54, 0x78, 0}, //a
+    {0, 0x7f, 0x44, 0x44, 0x38, 0}, //b
+    {0, 0x38, 0x44, 0x44, 0x28, 0}, //c
+    {0, 0x38, 0x44, 0x44, 0x7f, 0}, //d
+    {0, 0x38, 0x54, 0x54, 0x18, 0}, //e
+    {0, 0xf8, 0x24, 0x24, 0x08, 0}, //f
+    {0, 0x98, 0xa4, 0xa4, 0x78, 0}, //g
+    {0, 0x7f, 0x04, 0x04, 0x78, 0}, //h
+    {0, 0x44, 0x7d, 0x40, 0, 0}, //i
+    {0, 0x40, 0x80, 0x88, 0x7a, 0}, //j
+    {0, 0x7f, 0x10, 0x28, 0x44, 0}, //k
+    {0, 0x41, 0x7f, 0x40, 0, 0}, //l
+    {0x7c, 0x04, 0x7c, 0x04, 0x78, 0}, //m
+    {0, 0x7c, 0x04, 0x04, 0x78, 0}, //n
+    {0, 0x38, 0x44, 0x44, 0x38, 0}, //o
+    {0, 0xfc, 0x24, 0x24, 0x18, 0}, //p
+    {0, 0x18, 0x24, 0x24, 0xfc, 0}, //q
+    {0, 0x7c, 0x08, 0x04, 0x04, 0}, //r
+    {0, 0x48, 0x54, 0x54, 0x24, 0}, //s
+    {0, 0x04, 0x3f, 0x44, 0, 0}, //t
+    {0, 0x3c, 0x40, 0x40, 0x7c, 0}, //u
+    {0x1c, 0x20, 0x40, 0x20, 0x1c, 0}, //v
+    {0x1c, 0x20, 0x10, 0x20, 0x1c, 0}, //w
+    {0x44, 0x28, 0x10, 0x28, 0x44, 0}, //x
+    {0, 0x9c, 0xa0, 0xa0, 0x7c, 0}, //y
+    {0x44, 0x64, 0x54, 0x4c, 0x44, 0}, //z
+    {0x3e, 0x51, 0x49, 0x45, 0x3e, 0}, //0
+    {0, 0x42, 0x7f, 0x40, 0, 0}, //1
+    {0x42, 0x61, 0x51, 0x49, 0x46, 0}, //2
+    {0, 0x22, 0x41, 0x49, 0x36, 0}, //3
+    {0x08, 0x0c, 0x0a, 0x7c, 0x08, 0}, //4
+    {0, 0x27, 0x45, 0x45, 0x39, 0}, //5
+    {0, 0x3e, 0x49, 0x49, 0x32, 0}, //6
+    {0x63, 0x11, 0x09, 0x05, 0x03, 0}, //7
+    {0, 0x36, 0x49, 0x49, 0x36, 0}, //8
+    {0, 0x26, 0x49, 0x49, 0x3e, 0}, //9
+    {0, 0xb0, 0x70, 0, 0, 0}, //,
+    {0, 0x60, 0x60, 0, 0, 0}, //.
+    {0x10,0x27,0x40,0x40,0x27,0x10}, // :-)
+    {0,0,0,0,0,0} // prazno
+};
 
 class DotMatrix{
     
 public:
     DotMatrix(PinName data_input = dp2, PinName clock = dp6, PinName loadcs = dp24)
     :spi(data_input, clock, loadcs), turnedON(false), mod(scroll), char_trenutni(0),
-    char_offset(0), repeat(true), brzina_ms(1000)
-    {
+    char_offset(0), repeat(true), brzina_ms(1000), isAttached(false)
+    {    
+        recenica = "Kokolo moje jedino.";  
         for(int i = 0; i < 8; i++) buffer[i] = 0;
     }
     
@@ -24,7 +93,9 @@
     void turnON();
     void turnOFF();
     void PromijeniRecenicu(string recenica){
-        this->recenica =  recenica;
+        this->recenica =  " " + recenica;
+        char_trenutni = 0;
+        char_offset = 0;
     }
     void NadodajNaRecenicu(char c){
         recenica += c;   
@@ -49,65 +120,165 @@
         return repeat;   
     }
     
-    void inicijaliziraj(){
-        znakovi[0] = Znak(0x7e, 0x11, 0x11, 0x7e);
-        znakovi[1] = Znak(0x7e, 0x49, 0x49, 0x36);
-        znakovi[2] = Znak(0x3e, 0x41, 0x41, 0x22);
-        znakovi[3] = Znak(0x7f, 0x41, 0x41, 0x3e);
-        
-    }
     void setChar(char c, int offset)
     {
-        int index = c - 'A';
+        int index;
+        if(c >= 'A' && c <= 'Z')
+            index = c - 'A';
+        else if(c>= 'a' && c <='z')
+            index = c - 'a' + 26;
+        else if( c>= '0' && c <= '9')
+            index = c - '0' + 52;
+        else if (c== ',')
+            index = 62;
+        else if(c=='.')
+            index = 63;
+        else if(c==' ')
+            index = 65;
+        else
+            index = 64;
+        
         if(offset < 0)
         {
-            for(int i = 0; i < znakovi[index].vel + offset; i++)
+            for(int i = 0; i < 6 + offset; i++)
             {
-                buffer[i] = znakovi[index].niz[i - offset];   
+                buffer[i] = znakovi[index][i - offset];   
             }  
         }   
         else 
         {
-            for(int i = offset; i < 8 && i < znakovi[index].vel + offset; i++)
+            for(int i = offset; i < 8 && i < 6 + offset; i++)
             {
-                buffer[i] = znakovi[index].niz[i - offset];   
+                buffer[i] = znakovi[index][i - offset];   
             }
         }
-        
     }
     
     void displaySingleChar(char c){
-        setChar(c, 2);   
+        setChar(c, 1);   
         refresh();
     }
     
-    int buffer[8];
-    Znak znakovi[4];
-private:
-    void attach();
-    void prikaziScroll(){}
-    void prikaziCBC(){
+      
+    void prikaziScroll(){
         if(char_trenutni == recenica.size()) refresh();
         else {
+            setChar(recenica[char_trenutni], char_offset);
+            if(char_trenutni < recenica.size() - 1)
+                setChar(recenica[char_trenutni + 1], char_offset + 7);
+            
+            if(char_offset < -6){
+                char_offset = 1; // plus 7
+                char_trenutni++;
+            } 
+        }
+        
+        if(char_trenutni >= recenica.size() && repeat)
+            char_trenutni = 0;
+        
+    }
+    void prikaziCBC(){
+        if(char_trenutni == recenica.size()) refresh();
+        else {//ako ne bude valjao refresh ne bude prazno prikazivali... skloniti else i dole >= u > promijeniti
             displaySingleChar(recenica[char_trenutni]);
-            char_trenutni++;
-            if(char_trenutni ==  recenica.size() && repeat)
-            char_trenutni = 0; 
-            
+            char_trenutni++;       
         }
-    }    
+        
+         if(char_trenutni >= recenica.size() && repeat)
+            char_trenutni = 0;  
+    }
+        
+    int brzina_ms;    
+    string recenica;
+    int buffer[8];
+    
+private:
+    void attach();
+    void detach(){
+        if(isAttached) ticker.detach();
+        isAttached = false;   
+    }
+    
     
     MatrixSPI spi;
-    
     bool turnedON;
-    string recenica;
     ModPrikazivanja mod;
     int char_trenutni, char_offset;
     Ticker ticker;
-    //bool isAttached potrebno ako se ticker ne može 2. detachirati... 
+    bool isAttached; 
     bool repeat;
-    int brzina_ms;
 };
 
 
+
+void DotMatrix::refresh(){
+    for(int i = 0; i < 8; i++)
+    {
+        spi.sendCol(i, buffer[i]); 
+        buffer[i] = 0;  
+    }
+}
+
+void DotMatrix::setIntensity(float jacina){
+    if(jacina <= 0){
+        spi.turnOFF();
+        turnedON = false;   
+        
+        
+    } else if(jacina >= 0.98){
+        if(!turnedON){ 
+            spi.turnON();
+            turnedON = true;
+        }
+        
+        spi.sendSingle(MatrixSPI::intensity, 0x0f);
+    } else {
+        if(!turnedON){ 
+            spi.turnON();
+            turnedON = true;
+        }
+        
+        int temp =  jacina*0x0f;
+        spi.sendSingle(MatrixSPI::intensity, temp);
+    } 
+}
+
+void DotMatrix::attach()
+{
+    detach();
+    if(mod == scroll)
+    {
+        isAttached = true;
+        ticker.attach(this, &DotMatrix::prikaziScroll, brzina_ms/8);
+    } else if(mod == char_by_char){
+        isAttached = true;
+        ticker.attach(this, &DotMatrix::prikaziCBC, brzina_ms);
+    }
+}
+
+void DotMatrix::setSpeed_ms(int ms)
+{
+    brzina_ms = ms;
+    ticker.detach();
+    attach();   
+}
+
+void DotMatrix::turnON(){
+    if(!turnedON){
+        spi.turnON();
+        turnedON = true;
+        
+        attach();   
+    }
+}
+
+void DotMatrix::turnOFF(){
+    if(turnedON){
+        spi.turnOFF();
+        turnedON = false;
+        
+        ticker.detach();   
+    }   
+}
+
 #endif //DotMatrix_h
\ No newline at end of file
--- a/Mapa.h	Mon May 26 18:28:21 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-#include "mbed.h"
-#ifndef MAPA_H
-#define MAPA_H
-#include <vector>
-#include "Znak.h"
-
-class Mapa
-{
-    std::vector<Znak> znakovi;
-    public:
-        Mapa()
-        {
-            znakovi.reserve(10);
-            znakovi.push_back(Znak(0x7e, 0x11, 0x11, 0x7e)); //A
-            znakovi.push_back(Znak(0x7e, 0x49, 0x49, 0x36)); //B
-            znakovi.push_back(Znak(0x3e, 0x41, 0x41, 0x22)); //C
-            znakovi.push_back(Znak(0x7f, 0x41, 0x41, 0x3e)); //D
-            znakovi.push_back(Znak(0x7f, 0x49, 0x49, 0x41)); //E
-            znakovi.push_back(Znak(0x7f, 0x09, 0x09, 0x01)); //F
-            znakovi.push_back(Znak(0x3e, 0x41, 0x51, 0x32, 0x70)); //G
-            /*znakovi.push_back(Znak(0x7f, 0x08, 0x08, 0x7f)); //H
-            znakovi.push_back(Znak(0x41, 0x7f, 0x41)); //I
-            znakovi.push_back(Znak(0x21, 0x41, 0x41, 0x3f)); //J
-            znakovi.push_back(Znak(0x7f, 0x08, 0x14, 0x63)); //K
-            znakovi.push_back(Znak(0x7f, 0x40, 0x40, 0x40)); //L
-            znakovi.push_back(Znak(0x7f, 0x02, 0x0c, 0x02, 0x7f)); //M
-            znakovi.push_back(Znak(0x7f, 0x04, 0x08, 0x10, 0x7f)); //N
-            znakovi.push_back(Znak(0x3e, 0x41, 0x41, 0x3e)); //O
-            znakovi.push_back(Znak(0x7f, 0x09, 0x09, 0x06)); //P
-            znakovi.push_back(Znak(0x3e, 0x41, 0x51, 0x3e, 0x40)); //Q
-            znakovi.push_back(Znak(0x7f, 0x09, 0x09, 0x76)); //R
-            znakovi.push_back(Znak(0x26, 0x89, 0x89, 0x32)); //S
-            znakovi.push_back(Znak(0x03, 0x01, 0x7f, 0x01, 0x03));  //T
-            znakovi.push_back(Znak(0x1f, 0x20, 0x40, 0x40, 0x20, 0x3f));  //U
-            znakovi.push_back(Znak(0x1f, 0x20, 0x40, 0x20, 0x1f)); //V
-            znakovi.push_back(Znak(0x3f, 0x40, 0x38, 0x40, 0x3f)); //W
-            znakovi.push_back(Znak(0x63, 0x14, 0x08, 0x14, 0x63)); //X
-            znakovi.push_back(Znak(0x07, 0x08, 0x70, 0x08, 0x07)); //Y
-            znakovi.push_back(Znak(0x61, 0x51, 0x49, 0x45, 0x43)); //Z
-            znakovi.push_back(Znak(0x20, 0x54, 0x54, 0x78)); //a
-            znakovi.push_back(Znak(0x7f, 0x44, 0x44, 0x38)); //b
-            znakovi.push_back(Znak(0x38, 0x44, 0x44, 0x28)); //c
-            znakovi.push_back(Znak(0x38, 0x44, 0x44, 0x7f)); //d
-            znakovi.push_back(Znak(0x38, 0x54, 0x54, 0x18)); //e
-            znakovi.push_back(Znak(0xf8, 0x24, 0x24, 0x08)); //f
-            znakovi.push_back(Znak(0x98, 0xa4, 0xa4, 0x78)); //g
-            znakovi.push_back(Znak(0x7f, 0x04, 0x04, 0x78)); //h
-            znakovi.push_back(Znak(0x44, 0x7d, 0x40)); //i
-            znakovi.push_back(Znak(0x40, 0x80, 0x88, 0x7a)); //j
-            znakovi.push_back(Znak(0x7f, 0x10, 0x28, 0x44)); //k
-            znakovi.push_back(Znak(0x41, 0x7f, 0x40)); //l
-            znakovi.push_back(Znak(0x7c, 0x04, 0x7c, 0x04, 0x78)); //m
-            znakovi.push_back(Znak(0x7c, 0x04, 0x04, 0x78)); //n
-            znakovi.push_back(Znak(0x38, 0x44, 0x44, 0x38)); //o
-            znakovi.push_back(Znak(0xfc, 0x24, 0x24, 0x18)); //p
-            znakovi.push_back(Znak(0x18, 0x24, 0x24, 0xfc)); //q
-            znakovi.push_back(Znak(0x7c, 0x08, 0x04, 0x04)); //r
-            znakovi.push_back(Znak(0x48, 0x54, 0x54, 0x24)); //s
-            znakovi.push_back(Znak(0x04, 0x3f, 0x44)); //t
-            znakovi.push_back(Znak(0x3c, 0x40, 0x40, 0x7c)); //u
-            znakovi.push_back(Znak(0x1c, 0x20, 0x40, 0x20, 0x1c)); //v
-            znakovi.push_back(Znak(0x1c, 0x20, 0x10, 0x20, 0x1c)); //w
-            znakovi.push_back(Znak(0x44, 0x28, 0x10, 0x28, 0x44)); //x
-            znakovi.push_back(Znak(0x9c, 0xa0, 0xa0, 0x7c)); //y
-            znakovi.push_back(Znak(0x44, 0x64, 0x54, 0x4c, 0x44)); //z
-            znakovi.push_back(Znak(0x3e, 0x51, 0x49, 0x45, 0x3e)); //0
-            znakovi.push_back(Znak(0x42, 0x7f, 0x40)); //1
-            znakovi.push_back(Znak(0x42, 0x61, 0x51, 0x49, 0x46)); //2
-            znakovi.push_back(Znak(0x22, 0x41, 0x49, 0x36)); //3
-            znakovi.push_back(Znak(0x08, 0x0c, 0x0a, 0x7c, 0x08)); //4
-            znakovi.push_back(Znak(0x27, 0x45, 0x45, 0x39)); //5
-            znakovi.push_back(Znak(0x3e, 0x49, 0x49, 0x32)); //6
-            znakovi.push_back(Znak(0x63, 0x11, 0x09, 0x05, 0x03)); //7
-            znakovi.push_back(Znak(0x36, 0x49, 0x49, 0x36)); //8
-            znakovi.push_back(Znak(0x26, 0x49, 0x49, 0x3e)); //9
-            znakovi.push_back(Znak(0xb0, 0x70)); //,
-            znakovi.push_back(Znak(0x60, 0x60)); //.*/
-            
-            
-        }
-
-        ~Mapa() {}
-
-        std::vector<char>& operator[](char c)
-        {
-            if(c >= 'A' && c <= 'Z') return znakovi[c - 'A'].registri;
-            else if(c >= 'a' && c <= 'z') return znakovi[26 + c -'a' ].registri;
-            else if(c >= '0' && c <= '9') return znakovi[52 + c - '0' ].registri;
-        }
-};
-
-#endif // MAPA_H
--- a/Znak.h	Mon May 26 18:28:21 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-#include "mbed.h"
-#ifndef ZNAK_H
-#define ZNAK_H
-#include <vector>
-
-struct Znak
-{
-    
-        char niz[6];
-        char vel;
-        
-    Znak(int r0 = -1, int r1 = -1, int r2 = -1, int r3 = -1, int r4 = -1, int r5 = -1)
-    {
-            if(r0 != -1) {
-                niz[0] = r0; 
-                vel++;
-                if(r1 != -1){
-                    niz[1] = r1;
-                    vel++; 
-                }
-                if(r2 != -1){
-                    niz[2] = r2;
-                    vel++;  
-                    if(r3 != -1){
-                     niz[3] = r3;
-                        vel++;
-                        if(r4 != -1){
-                            niz[4] = r4;
-                            vel++;   
-                            if(r5 != -1){
-                                niz[5] = r5;
-                                vel++;   
-                            }
-                        }
-                    } 
-                }
-                
-            }
-            
-    }
-
-};
-
-#endif // ZNAK_H
--- a/main.cpp	Mon May 26 18:28:21 2014 +0000
+++ b/main.cpp	Mon Jun 02 15:35:11 2014 +0000
@@ -1,32 +1,192 @@
 #include "mbed.h"
 #include "DotMatrix.h"
-
 #include "MatrixSPI.h"
 
-MatrixSPI mspi;
-
-/*void funkcija(){
-    int temp = pot*16; 
-    load = LOW;
-    max72_spi.write(max7219_reg_intensity);
-    max72_spi.write(temp);
-    load = HIGH; 
-}*/
-
+//MatrixSPI mspi;
 DotMatrix d;
-int main() {
-   
-   
-   d.inicijaliziraj();
-    d.PromijeniMod(char_by_char);
-   d.PromijeniRecenicu("ABCD");
+Serial pc(USBTX, USBRX);
+
+
+
+void Meni()
+{
+    pc.printf("1 - promjena teksta \n2 - promjena moda\n3 - promjena osvjetljenja\n4 - ukljuci prikaz teksta\n4 - iskljuci prikaz teksta\n6 - live input\nUnos: ");
+    char komanda = pc.getc();
+       
+        if(komanda == '1')
+        {
+            pc.printf ("\nUnesite novi tekst: ");
+            string line;
+            char c = pc.getc();
+            while (c != '\n')
+            {
+                line.push_back(c);
+                c = pc.getc();
+            }
+            d.PromijeniRecenicu(line);
+        } 
+        else if (komanda == '2')
+        {
+            char c;
+            do
+            {
+                pc.printf("1 - scroll \n2 - slovo po slovo\n0 - povratak na glavni meni\nMod: ");
+                c = pc.getc();
+                if(c == '1') d.PromijeniMod(scroll);
+                else if(c == '2') d.PromijeniMod(char_by_char); 
+            }
+            while(c < '0' || c > '2');
+        } else if (komanda == '3') 
+        {
+            char c;
+            do
+            {
+                pc.printf("Unesite broj od 0 do 9 za promjenu osvjetljenja:  ");
+                c = pc.getc();
+                if(c >= '0' && c <= '9') d.setIntensity((c - '0')/ 10.0);
+            }
+            while(c < '0' || c > '9');
+        } 
+        else if (komanda == '4')
+        {
+            d.turnON();
+        }
+        else if (komanda == '5')
+        {
+            d.turnOFF();
+        }
+        else if (komanda == '6')
+        {
+            char c;
+            while ((c = pc.getc()) != '\n') d.displaySingleChar(c);
+            d.refresh();
+        }
+        else pc.printf ("Unos nije ispravan!!!\nPonovite unos: ");
+}
+ 
+
+void test1(){
+    d.displaySingleChar('L');
+    wait(0.33);
+    d.displaySingleChar('U');
+    wait(0.33);
+    d.displaySingleChar('K');
+    wait(0.33);
+    d.displaySingleChar('A');
+    wait(0.33);
+    d.displaySingleChar('i');
+    wait(0.33);
+    d.displaySingleChar('e');
+    wait(0.33);
+    d.displaySingleChar('l');
+    wait(0.33);
+    d.displaySingleChar('m');
+    wait(0.33);
+    d.displaySingleChar('i');
+    wait(0.33);
+    d.displaySingleChar('e');
+    wait(0.33);
+    d.displaySingleChar('.');
+    wait(0.33);
+    d.displaySingleChar(',');
+    wait(0.33);
+    d.displaySingleChar('Ć');
+    wait(0.33);
+    d.displaySingleChar('L');
+    wait(0.33);
+
+    for(int i = 0; i < 10; i++)
+    {
+        char c = (i%2? 'M' : 0);
+        d.displaySingleChar(c);
+            wait(0.5);
+    }
+    
+}
   
-    //enable = 1;
-    /*t.attach(&funkcija, 0.01);
-    setup ();*/
-    while(1){}
+void test2(){
+    d.setChar('L',1);
+    d.refresh();
+    wait(0.33);
+    d.setChar('U',1);
+    d.refresh();
+    wait(0.33);
+    d.setChar('K',1);
+    d.refresh();
+    wait(0.33);
+    d.setChar('A',1);
+    d.refresh();
+    wait(0.33);
+    d.setChar('i',1);
+    d.refresh();
+    wait(0.33);
+    d.setChar('e',1);
+    d.refresh();
+    wait(0.33);
+    d.setChar('l',1);
+    d.refresh();
+    wait(0.33);
+    d.setChar('m',1);
+    d.refresh();
+    wait(0.33);
+    d.setChar('i',1);
+    d.refresh();
+    wait(0.33);
+    d.setChar('e',1);
+    d.refresh();
+    wait(0.33);
+    d.setChar('.',1);
+    d.refresh();
+    wait(0.33);
+    d.setChar(',',1);
+    d.refresh();
+    wait(0.33);
+    d.setChar(0,1);
+    d.refresh();
+    wait(0.33);
+    d.setChar('L',1);
+    d.refresh();
+    wait(0.33);
+
+    
+    for(int i = 0; i < 60; i++)
+    {
+        d.setChar('M', (i%16)-8);
+        d.refresh();
+            wait(0.25);
+    }
+    
+}
+
+void test3(){//test recenica
+    d.PromijeniRecenicu("Luka bio ovdje");
+    bool t = false;
+    
+    for(int i = 0; i < d.recenica.size(); i++){
+        d.displaySingleChar(d.recenica[i]);
+        
+        wait(t ? d.brzina_ms*1000 : 0.25);   
+    }
 }
 
 
 
-
+int main() 
+{
+   
+    d.PromijeniMod(char_by_char);
+    d.turnON();
+    for(int i = 0; i < d.recenica.size(); i++)
+    {
+        pc.putc(d.recenica[i]);   
+    }
+    pc.putc('\n');
+    //enable = 1;
+    /*t.attach(&funkcija, 0.01);
+    setup ();*/
+    Meni();
+    while(1)
+    {
+        
+    }
+}
\ No newline at end of file