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.
main.cpp
- Committer:
- stvnrhodes
- Date:
- 2012-04-21
- Revision:
- 3:39ae37b9c936
- Parent:
- 2:d3a99fd96468
File content as of revision 3:39ae37b9c936:
#include "mbed.h"
#include "Wifly.h"
#include "Bitmap.h"
LocalFileSystem local("local");
Serial pc(USBTX, USBRX);
DigitalOut led(LED1);
DigitalOut solenoid(p29);
Wifly wifi(p9, p10, p8);
Command * cmd;
Bitmap bmp;
int main() {
solenoid = 0;
pc.baud(460800);
printf("Test Airbrush!\r\n");
wifi.createAdhocNetwork();
/* bmp.openImg("/local/a.bmp");
for (int i=0; i < bmp.getHeight(); i++) {
pc.printf("Row %3d: ", i);
bmp.setRow(i);
for (int j=0; j < bmp.getWidth(); j++) {
if(bmp.isPixel(j)) {
pc.printf("1");
} else {
pc.printf(" ");
}
}
pc.printf("\n\r");
}
bmp.closeImg();*/
while (1) {
while(pc.readable()) {
wifi.putc(pc.getc());
}
while(wifi.readable()){
pc.putc(wifi.getc());
}
if(wifi.hasCmd()){
cmd = wifi.getCmd();
switch(cmd->cmd) {
case 0x00:
pc.printf("Move to x: %d, y:%d, z:%d\n\r", cmd->l[0], cmd->l[1], cmd->l[2]);
wait(2);
break;
default:
pc.printf("You should probably do something with case %x\n\r", cmd->cmd);
}
cmd->cmd = 8;
cmd->l[0] = 100;
cmd->l[1] = 300;
cmd->l[2] = 0;
cmd->f[3] = 0.5;
cmd->f[4] = 0.0;
wifi.sendCmd(cmd);
}
}
}