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.
Diff: classes.h
- Revision:
- 24:92f612ca218b
- Child:
- 26:f891ff6beb33
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/classes.h Tue May 15 18:38:50 2018 +0000
@@ -0,0 +1,44 @@
+#define tx PC_10
+#define rx PC_11
+
+#define sendTime 0.1
+
+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%.3f", X);
+ buffer.append(buffer_char);
+ n = sprintf(buffer_char, "Y%.3f", Y);
+ buffer.append(buffer_char);
+ n = sprintf(buffer_char, "Z%.3f", Z);
+ buffer.append(buffer_char);
+
+ send(buffer);
+ }
+
+ private:
+
+ // PRIVATE FUNCTIONS ----------------------------------------------------------------------------------------------------------------------------------------
+ void send(string msg){
+ msg.append("x");
+
+ for(int i = 0; i < msg.length(); i++){
+ ihm.putc(msg[i]);
+ wait_us(1);
+ }
+ }
+};
\ No newline at end of file