This Project has codes that may cnc controller possible. My cnc has 2 mechanical axis. I am monitoring through switches the axis limits. For this i use the library rtos. Enjoy.

Dependencies:   mbed-rtos mbed

Revision:
0:7cedfb720712
diff -r 000000000000 -r 7cedfb720712 Debug.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Debug.h	Wed Jun 07 13:31:02 2017 +0000
@@ -0,0 +1,21 @@
+#ifndef DEBUG_H
+#define DEBUG_H
+#include "mbed.h"
+
+#define HIGH  1
+#define LOW   0
+
+class Debug{
+    
+    public:
+            Debug();
+            void debugPin(int, int);
+    
+            DigitalOut *debugPin_1;
+            DigitalOut *debugPin_2;
+            DigitalOut *debugPin_3;
+            DigitalOut *debugPin_4;
+
+};
+
+#endif