UART Code Example for Serial Communication Workshop - IEEETAMU

Dependencies:   mbed tsi_sensor

Files at this revision

API Documentation at this revision

Comitter:
MoffMade
Date:
Fri Mar 06 21:40:15 2015 +0000
Commit message:
V1.0 UART Example for Serial Communications Workshop

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
tsi_sensor.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r d2c37d6f4b0c main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Mar 06 21:40:15 2015 +0000
@@ -0,0 +1,18 @@
+#include "mbed.h" // libraries
+#include "tsi_sensor.h"
+
+#define ELEC0 9 // these are the pin numbers for capacitive touch
+#define ELEC1 10
+
+Serial pc(USBTX, USBRX); // configure UART pins
+int main()
+{
+    pc.baud(9600);  //Set baud rate for UART module
+    int sliderValue = 0; // holder variable
+    TSIAnalogSlider tsi(ELEC0, ELEC1, 40); // configure capacitive (CT) touch pins
+    while (true) { // loop forever
+        wait(0.1f); // wait a small period of time
+        pc.printf("Touch Value is: %d\r\n", sliderValue); // print the value
+        sliderValue = (char)(256 * tsi.readPercentage());; // get value from CT
+    }
+}
diff -r 000000000000 -r d2c37d6f4b0c mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Mar 06 21:40:15 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/7e07b6fb45cf
\ No newline at end of file
diff -r 000000000000 -r d2c37d6f4b0c tsi_sensor.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsi_sensor.lib	Fri Mar 06 21:40:15 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Kojto/code/tsi_sensor/#f64097679f27