Dimple Bhuta / Mbed 2 deprecated Nucleo_readtactilesensors

Dependencies:   mbed

Fork of Nucleo_readtactilesensors_transmit256total by Dimple Bhuta

Files at this revision

API Documentation at this revision

Comitter:
DimpleB05
Date:
Wed Mar 29 07:42:23 2017 +0000
Parent:
0:6460a0d26927
Commit message:
Readtactilesensor_interfacewith_processingIDE;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Feb 17 06:07:42 2017 +0000
+++ b/main.cpp	Wed Mar 29 07:42:23 2017 +0000
@@ -6,7 +6,7 @@
 #include "mbed.h"
 
 #define FPS
-#define BAUD        460800
+#define BAUD         115200
 #define N_CHANNELS  256
 
 AnalogIn in(A0);
@@ -23,7 +23,6 @@
 Serial pc(USBTX,USBRX);
 
 int in_value = 0;
-int value_sum = 0;
 uint8_t mux_ch_map[16] = {6,7,5,4,0,1,2,3,14,12,13,15,8,9,11,10};
 
 int counter = 0;
@@ -34,8 +33,8 @@
 {
     pc.baud(BAUD);
     
-   // pc.printf("Nucleo 16x16 basic raster\r\n");
-   // pc.printf("Initializing...\r\n");
+    pc.printf("Nucleo 16x16 basic raster\r\n");
+    pc.printf("Initializing...\r\n");
     // reset registers and intialize peripherals
     mux_en = 0;  // power off mux
     mux_ch0 = 0;
@@ -52,8 +51,8 @@
     mux_en = 1;
     reg_clr = 1;
     wait_ms(100);
-    //pc.printf("Clock speed: %d\r\n", SystemCoreClock);
-    //pc.printf("Started scanning\r\n");
+    pc.printf("Clock speed: %d\r\n", SystemCoreClock);
+    pc.printf("Started scanning\r\n");
 
     // do a single read using original read_u16 code
     in_value = in.read_u16();
@@ -67,7 +66,7 @@
 //             0 connects trace to ground. Only 1 grounded trace per cycle is needed.
 
             if(row == 0) {
-                //pc.printf("\n");
+                pc.printf("\n");
                 led = !led; // blink to indicate operation
                 reg_din.write(1);
             } else {
@@ -82,8 +81,7 @@
             
             // 2nd part of bit-bashing clock
             reg_clk.write(0);
-            
-/* Wait period after reading 100 frames
+/*
 #ifdef FPS            
             // benchmarking only if FPS is defined
             if(row == 0) {
@@ -97,8 +95,7 @@
                     counter = 0;
                 }
             }
-#endif
-*/
+#endif*/
             for (int col=0; col<16; col++) {
                 mux_val = mux_ch_map[15-col];
                 mux_ch0.write(mux_val & 0x01);
@@ -107,14 +104,9 @@
                 mux_ch3.write((mux_val >> 3) & 0x01);
                 wait_us(1);
                 in_value = in.read_u16()>>4;
-                // Add a variable to add the in_value
-                value_sum = value_sum + in_value;
-               // pc.printf("%d,",in_value);
-            }            
-         }
-         //Total 256 values
-            pc.printf("%d,",value_sum);
-            value_sum =0;
-    }          
+                pc.printf("%d,",in_value);
+            }
+        }
+    }
 }