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: StepperMotors mbed CNCAirbrush Servo
Diff: main.cpp
- Revision:
- 1:f3fda065e614
- Parent:
- 0:ba40c5f30cf0
diff -r ba40c5f30cf0 -r f3fda065e614 main.cpp --- 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)