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.
Fork of linearMirrorMotion1017 by
Diff: main.cpp
- Revision:
- 27:38bc8dc67dab
- Parent:
- 26:74ecbf9985e1
- Child:
- 28:d86c629b6fd3
--- a/main.cpp Mon Jul 22 08:09:18 2013 +0000
+++ b/main.cpp Tue Jul 23 03:01:35 2013 +0000
@@ -29,6 +29,8 @@
float vx = 0, vy=0;
float theta=0, dt_betWords=50000, st=1800;
int laserColor=1, ticktime=600;
+int potxx = 0,potyy = 0;
+
bool newPositionReady=false;
unsigned int counter=0;
@@ -84,8 +86,8 @@
angleX = inx;
angleY = iny;
- PotX = inPotX;
- PotY = inPotY;
+ PotX = 0.25*potxx;//inPotX;
+ PotY = 0.25*potyy;//inPotY;
// low pass filter (recusive filter):
float alpha=.35; // alpha=dt/(RC+dt), with dt=COMPUTE_SPEED, and f_cut=1/(2*PI*RC) is the filter cutoff frequency
@@ -200,30 +202,13 @@
else if (val == 'X') {
beforeX = X;
stringData[indexStringData] = 0;
- X = atoi(stringData);
+ potxx = atoi(stringData);
indexStringData=0;
- //vx = ((float)X-(float)beforeX) / (float)timer_v.read_us() *1000;
- }
-
- else if (val == 'Y') {
+ } else if (val == 'Y') {
beforeY = Y;
stringData[indexStringData] = 0;
- Y = atoi(stringData);
+ potyy = atoi(stringData);
indexStringData=0;
- //timer_v.stop();
- //newSpeedReady = true;
- //if( (Y-beforeY) > 5){
- //vy = ((float)Y-(float)beforeY) / (float)timer_v.read_us() *1000;
-
- //myRender.updateSpeed(vx, vy);
-
-
- }
-
- else if (val == 'Y') {
- stringData[indexStringData] = 0;
- myRender.laserColor = 6;
- //makeBuffer();
} else if (val == 'R') {
stringData[indexStringData] = 0;
myRender.laserColor = 2;
