pcinput

Files at this revision

API Documentation at this revision

Comitter:
ijajcevic
Date:
Tue Mar 02 22:35:23 2021 +0000
Commit message:
za pc inpute s tipkovnice

Changed in this revision

pcinput.cpp Show annotated file Show diff for this revision Revisions of this file
pcinput.h Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 0c7e0cd456ba pcinput.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pcinput.cpp	Tue Mar 02 22:35:23 2021 +0000
@@ -0,0 +1,21 @@
+// input s tikovnice
+#include "pcinput.h"
+Serial pc(USBTX, USBRX); // komunikacija s recunalom
+void inicijalizacija(void)
+{
+    pc.printf("\n\r Unesi vrjednost:\n\r");
+}
+char KeyInput(void)
+{
+    char c = pc.getc(); // dobivanje ulaza s tikovnice
+    int uvijet;
+    uvijet = c;
+    if (uvijet < 48 ){
+        c = 48;
+        }
+    if (uvijet > 58){
+        c = 58;
+        }
+    pc.printf("%c",c); // isprintaj na teraterm
+    return (c); // vrati vrijednost znaka
+}
\ No newline at end of file
diff -r 000000000000 -r 0c7e0cd456ba pcinput.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pcinput.h	Tue Mar 02 22:35:23 2021 +0000
@@ -0,0 +1,8 @@
+// pcinput.h za mikoupravljace
+#ifndef PCINPUT_H
+#define PCINPUT_H
+#include "mbed.h"
+extern Serial pc; // dopustanje manipulacije iz vana
+void inicijalizacija(void); // funkcija
+char KeyInput(void); // funkcija
+#endif