v1.1

Dependencies:   mbed QEI

Revision:
1:8e3af9643155
Parent:
0:ef2ee7458c37
Child:
2:eb82f5cb5098
--- a/main.cpp	Sun May 05 10:14:52 2019 +0000
+++ b/main.cpp	Sun May 05 10:19:43 2019 +0000
@@ -6,18 +6,15 @@
 QEI temp_dial(D11, D12, A1, 50, QEI::X4_ENCODING);
 BusIn joy_bus{D3, D4, D5, D6};
 BusIn button_bus{D7, D9};
-DigitalIn a(D7),b(D9),c(D3),d(D4),e(D5),f(D6);
+DigitalIn a(D7),b(D9),c(D3),d(D4),e(D5),f(D6); //Dummy pin for pulling
 
 
+void init_();
+
 int main() {
     pc.baud(115200);
     long pulse = 0;
-    a.mode(PullDown);
-    b.mode(PullDown);
-    c.mode(PullDown);
-    d.mode(PullDown);
-    e.mode(PullDown);
-    f.mode(PullDown);
+    init_();
     while(1){
         pulse = temp_dial.getPulses()/2;
         pc.printf("%d \t%d\n",joy_bus.read(), button_bus.read());
@@ -26,3 +23,12 @@
     }
 }
 
+
+void init_(){
+    a.mode(PullDown);
+    b.mode(PullDown);
+    c.mode(PullDown);
+    d.mode(PullDown);
+    e.mode(PullDown);
+    f.mode(PullDown);   
+}
\ No newline at end of file