Ivan Jajčević / Mbed OS projekt

Dependencies:   pcinput TextLCD

Committer:
ijajcevic
Date:
Mon Mar 01 18:52:33 2021 +0000
Revision:
0:8c4ff7ea7eb9
Projektni zadatak

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ijajcevic 0:8c4ff7ea7eb9 1 // input s tikovnice
ijajcevic 0:8c4ff7ea7eb9 2 #include "pcinput.h"
ijajcevic 0:8c4ff7ea7eb9 3 Serial pc(USBTX, USBRX); // komunikacija s recunalom
ijajcevic 0:8c4ff7ea7eb9 4 void inicijalizacija(void)
ijajcevic 0:8c4ff7ea7eb9 5 {
ijajcevic 0:8c4ff7ea7eb9 6 pc.printf("\n\r Unesi vrjednost:\n\r");
ijajcevic 0:8c4ff7ea7eb9 7 }
ijajcevic 0:8c4ff7ea7eb9 8 char KeyInput(void)
ijajcevic 0:8c4ff7ea7eb9 9 {
ijajcevic 0:8c4ff7ea7eb9 10 char c = pc.getc(); // dobivanje ulaza s tikovnice
ijajcevic 0:8c4ff7ea7eb9 11 int uvijet;
ijajcevic 0:8c4ff7ea7eb9 12 uvijet = c;
ijajcevic 0:8c4ff7ea7eb9 13 if (uvijet < 48 ){
ijajcevic 0:8c4ff7ea7eb9 14 c = 48;
ijajcevic 0:8c4ff7ea7eb9 15 }
ijajcevic 0:8c4ff7ea7eb9 16 if (uvijet > 58){
ijajcevic 0:8c4ff7ea7eb9 17 c = 58;
ijajcevic 0:8c4ff7ea7eb9 18 }
ijajcevic 0:8c4ff7ea7eb9 19 pc.printf("%c",c); // isprintaj na teraterm
ijajcevic 0:8c4ff7ea7eb9 20 return (c); // vrati vrijednost znaka
ijajcevic 0:8c4ff7ea7eb9 21 }