Adam Resnick / Mbed 2 deprecated CNCAirbrushCode

Dependencies:   StepperMotors mbed CNCAirbrush Servo

Files at this revision

API Documentation at this revision

Comitter:
stretch
Date:
Fri May 04 06:25:59 2012 +0000
Parent:
0:ba40c5f30cf0
Commit message:

Changed in this revision

CNCAirbrush.lib Show annotated file Show diff for this revision Revisions of this file
StepperMotors.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/CNCAirbrush.lib	Sat Apr 28 21:11:15 2012 +0000
+++ b/CNCAirbrush.lib	Fri May 04 06:25:59 2012 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/stretch/code/CNCAirbrush/#27e403b8981e
+http://mbed.org/users/stretch/code/CNCAirbrush/#e16f55e9dcd3
--- a/StepperMotors.lib	Sat Apr 28 21:11:15 2012 +0000
+++ b/StepperMotors.lib	Fri May 04 06:25:59 2012 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/stretch/code/StepperMotors/#3058939fa37c
+http://mbed.org/users/stretch/code/StepperMotors/#cf60b60a1b5b
--- a/main.cpp	Sat Apr 28 21:11:15 2012 +0000
+++ b/main.cpp	Fri May 04 06:25:59 2012 +0000
@@ -8,6 +8,10 @@
 #define PAN_RANGE 0.0009
 #define PAN_DEGREE 90
 #define PAN_CENTER 0.0002
+#define STEPS_PER_PIXEL_DEFAULT 600
+#define INITIAL_DELAY_DEFAULT 1200
+#define STEP_BUFFER_DEFAULT 4
+#define DEFAULT_FEEDRATE 200
 
 LocalFileSystem local("local");
 Serial pc(USBTX, USBRX);
@@ -79,10 +83,12 @@
     pc.baud(460800);
     printf("Test Airbrush!\r\n");
     linearMotion.setStepMotors(&x, &y, &z, &solenoid, &paused, &stopped);
+    linearMotion.updateSettings(STEPS_PER_PIXEL_DEFAULT, INITIAL_DELAY_DEFAULT, STEP_BUFFER_DEFAULT);
     wifi.createAdhocNetwork();
     wifi.attach_interrupt(0x09, pause, 0);
     wifi.attach_interrupt(0x0a, stop, 1);
     led = 1;
+    long paintingFeedrate = DEFAULT_FEEDRATE;
     while (1) {
         while (pc.readable()) {
             wifi.putc(pc.getc());
@@ -130,7 +136,7 @@
                                         cmd->l[4],
                                         cmd->l[5]};
                     pc.printf("Paint the image with corners at (x:%d, y:%d, z:%d), (x:%d, y:%d, z:%d) and (x:%d, y:%d, z:%d)\n\r", x.getPosition(), y.getPosition(), z.getPosition(),baseVector.x,baseVector.y,baseVector.z,heightVector.x,heightVector.y,heightVector.z);
-                    linearMotion.interpolateSquare(baseVector,heightVector,200,true);
+                    linearMotion.interpolateSquare(baseVector,heightVector,paintingFeedrate,true);
                     break;
                 }
                 case 0x04: { //change the pan
@@ -145,7 +151,12 @@
                     pc.printf("Change the tilt to %f\n\r",tilt);
                     break;
                 }
-
+                case 0x06: {
+                    linearMotion.updateSettings(cmd->l[0], cmd->l[1], cmd->l[2]);
+                    paintingFeedrate = cmd->l[3];
+                    break;
+                    
+                }
                 case 0x07: { //turn on the solenoid
                     long t = cmd->l[0];
                     if (t)