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: mbed filesystem TextLCD
Fork of Projeto_Mecatronico by
Diff: posicionamento.h
- Revision:
- 13:e1de9d8d635c
- Parent:
- 8:80c72f7ee7da
- Child:
- 18:6631cd661227
--- a/posicionamento.h Wed May 04 00:31:37 2022 +0000
+++ b/posicionamento.h Wed May 04 04:16:38 2022 +0000
@@ -1,31 +1,47 @@
#include "mbed.h"
#include "movimento.h"
#include "mover.h"
-void posicionamento ()
+#include "LCD.h"
+int posicionamento ()
{
- lcd.printf("Confirmar o posicionamento XY?")
-
+ int x_passos = 0;
+ int y_passos = 0;
+ int z_passos = 0;
+ lcd.printf("Confirmar o posicionamento XY?");
while(button_enter == 0) {
- x = xAxis.read() * 1000;
- y = 1000 - yAxis.read() * 1000;
- if(x > 600) {
- x_mais()
+ switch (direcao_botao_analogico()) {
+ case "direita":
+ x_mais();
+ x_passos++;
+ break;
+
+ case "esquerda":
+ x_menos();
+ x_passos--;
+ break;
+
+ case "frente":
+ y_mais();
+ y_passos++;;
+ break;
+
+ case "tras":
+ y_menos();
+ y_passos++;
+ break;
}
- if(x<400) {
- x_menos ()
- }
-
- if (y>600) {
- y_mais()
- }
- if (y>600) {
- y_menos()
- }
-
-
-
-
}
-}
\ No newline at end of file
+ lcd.printf("Confirmar o posicionamento Z?");
+ while(button_enter == 0) {
+ if(arrow_up_button ==1 && arrow_down_button==0) {
+ z_mais();
+ z_passos++
+ } else(arrow_down_button == 1 && arrow_up_button==0) {
+ z_menos();
+ z_passos--;
+ }
+ return x_passos/50, y_passos/50, z_passos/50;
+
+ }
\ No newline at end of file
