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.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 7:6b27977d1800
- Parent:
- 6:4ade0e1a3723
- Child:
- 8:d27efcac2dd7
--- a/main.cpp Fri Mar 31 23:32:30 2017 +0000
+++ b/main.cpp Fri Mar 31 23:40:20 2017 +0000
@@ -13,6 +13,12 @@
int i;
+//previous point values
+int prevX = 1023;
+int prevY = 1023;
+
+
+
//point variables
int point1x = 0;
int point1y = 0;
@@ -107,6 +113,7 @@
+
//POINT 1
//get data
point1x = data_buf[1];
@@ -116,6 +123,20 @@
onex[0] = point1x + ((s & 0x30) << 4);
oney[0] = point1y + ((s & 0xC0) << 2);
+ if(prevX != 1023 || prevY != 1023){
+ if(onex[0] - prevX > 5){
+ keyOut.putc(0x41);
+ } else if ((onex[0] - prevX) < -5){
+ keyOut.putc(0x42);
+
+ }
+ }
+
+ //update prev values
+ prevX = onex[0];
+ prevY = oney[0];
+
+
//POINT 2
//get data
point2x = data_buf[4];
@@ -156,9 +177,10 @@
//y coordinate
pc.printf(" %d\t", y);
- if(x < 800 ){
- keyOut.putc(0x41);
- }
+ //print A if x is less than 800
+ // if(x < 800 ){
+// keyOut.putc(0x41);
+// }
}
//new line and delay
@@ -186,7 +208,7 @@
while(1) {
- wait(0.01);
+ wait(0.04);
myled = 1 - myled;
//get the camera data

