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: main.cpp
- Revision:
- 2:edc5d3177f86
- Parent:
- 1:d5b85bc9e87b
- Child:
- 3:e4e890a46ff8
diff -r d5b85bc9e87b -r edc5d3177f86 main.cpp
--- a/main.cpp Fri Apr 03 22:06:47 2020 +0000
+++ b/main.cpp Wed May 27 15:16:45 2020 +0000
@@ -1,43 +1,61 @@
#include "mbed.h"
#include "LCD_ka.h"
+LCD lcd(D8, D9, D4, D5, D6, D7);
+AnalogIn Buts(A0);
AnalogIn Ya(A1);
AnalogIn Xa(A2);
-DigitalIn botao(D3);
int main(){
- Inicia_LCD();
int y = Ya.read()*1000;
int x = Xa.read()*1000;
- disp("Josueb6$#@!");
-
- while(1){
- int y = Ya.read()*1000;
- int x = Xa.read()*1000;
- wait(0.00002);
- if (botao == 0){
- apaga();
- wait(0.3);
+ while(1){
+ y = Ya.read()*1000;
+ x = Xa.read()*1000;
+
+ if ((Buts.read()*1000 > 750) && (Buts.read()*1000 < 850)){
+ lcd.printf("select");
+ wait(0.5);
+ }
+ if ((Buts.read()*1000 > 400) && (Buts.read()*1000 < 500)){
+ lcd.printf("left");
+ wait(0.5);
}
+ if ((Buts.read()*1000 > 200) && (Buts.read()*1000 < 300)){
+ lcd.printf("down");
+ wait(0.5);
+ }
+ if ((Buts.read()*1000 > 60) && (Buts.read()*1000 < 150)){
+ lcd.printf("up");
+ wait(0.5);
+ }
+ if ((Buts.read()*1000 > 0) && (Buts.read()*1000 < 50)){
+ lcd.printf("right");
+ wait(0.5);
+ }
+
if((x < 400)||(x > 600)||(y < 400)||(y > 600)){
- int y = Ya.read()*1000;
- int x = Xa.read()*1000;
+ y = Ya.read()*1000;
+ x = Xa.read()*1000;
if (x > 900){
- direita();
+ lcd.direita();
+ wait(0.2);
+ }
+
+ if (x < 100){
+ lcd.esquerda();
wait(0.2);
}
if (y > 900){
- baixo();
- wait(0.2);
- }
- if (x < 100){
- esquerda();
+ lcd.baixo();
wait(0.2);
}
if (y < 100){
- cima();
+ lcd.cima();
wait(0.2);
}
}
+
+
}
}