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.
classes.h
- Committer:
- lucasfontenla
- Date:
- 2018-05-17
- Revision:
- 26:f891ff6beb33
- Parent:
- 24:92f612ca218b
- Child:
- 27:3bbc354adea6
File content as of revision 26:f891ff6beb33:
#define tx PC_10
#define rx PC_11
#define sendTime 0.5
Serial ihm(tx, rx); //tx e rx (D1 e D0)
class IHM {
int n;
string buffer;
char buffer_char[8];
public:
int debug;
// PUBLIC FUNCTIONS ----------------------------------------------------------------------------------------------------------------------------------------
void send_position(float X, float Y, float Z){
//printf("Position sent\n\r");
buffer = "";
buffer.append("p");
n = sprintf(buffer_char, "X%.2f", X);
buffer.append(buffer_char);
n = sprintf(buffer_char, "Y%.2f", Y);
buffer.append(buffer_char);
n = sprintf(buffer_char, "Z%.2f", Z);
buffer.append(buffer_char);
send(buffer);
}
void action_complete(void){
send("a");
}
private:
// PRIVATE FUNCTIONS ----------------------------------------------------------------------------------------------------------------------------------------
void send(string msg){
msg.append("x");
for(int i = 0; i < msg.length(); i++){
ihm.putc(msg[i]);
wait_ms(15);
}
printf("Sent\n\r");
}
};