Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 0:cdbd21489e81
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Tue Nov 30 22:03:27 2010 +0000
@@ -0,0 +1,52 @@
+#include "mbed.h"
+#include "touch0.h"
+#include "touch1.h"
+#include "sense.h"
+#define numsamples 1
+//DigitalOut myled0(LED1);
+//DigitalOut myled1(LED2);
+DigitalOut myled2(LED3);
+DigitalOut myled3(LED4);
+Serial pc(USBTX, USBRX); // tx, rx
+
+int main() {
+ char r='n';
+ int sp;
+ while (1) {
+ int match=1;
+ r=pc.getc();
+ while (r!='S') {
+ r=pc.getc();
+ }
+ while ((r!='E')&(match==1)) {
+// pc.printf("abc");
+ do {
+ r=pc.getc();
+ } while ((r!='E')&(r!='0')&(r!='1'));
+ if (r=='E') {
+ break;
+ }
+ sp=sense();
+ if (sp==2) {
+ match=2;
+ break;
+ } else {
+ if (((sp==1)&(r=='1'))^((sp==0)&(r=='0')))
+ match=1;
+ else
+ match=0;
+ }
+ }
+ switch (match) {
+ case 0:
+ pc.printf("HOST ERROR \n\r");
+ break;
+ case 1:
+ pc.printf("MATCH \n\r");
+ break;
+ case 2:
+ pc.printf("Touch Error \n\r");
+ break;
+ }
+ }
+}
\ No newline at end of file