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:
- 0:68fe010d5a55
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Nov 02 10:05:21 2017 +0000
@@ -0,0 +1,70 @@
+
+// https://www.youtube.com/watch?v=yScO_v7NUYQ
+// LEITURA DE BOTÕES
+
+#include "mbed.h"
+#include "TextLCD.h"
+
+
+//FRDM-K64F
+//TextLCD lcd(PTA0,PTC4,PTB23,PTA2,PTC2,PTC3); // rs, e, d4-d7
+TextLCD lcd(D8, D9, D4, D5, D6, D7); // rs, e, d4-d7
+Ticker t;
+
+
+
+AnalogIn Sensor(PTB2); //ESPECIFICA O PINO DE LEITURA ANALOGICA PARA FRDM-K64F
+
+int main() {
+
+ lcd.printf(" Calibration \n FRDM-K64F");
+ wait(3);
+ lcd.cls(); // Clean the display
+
+ while(1){
+ wait(1);
+ //lcd.locate(0,1);
+ //float x=Sensor.read_u16();
+ //lcd.printf("Value:(%f)",x);
+
+
+ if(Sensor.read_u16()>12000 && Sensor.read_u16()< 15000){
+ lcd.printf("Procedure \n will start");
+ wait(3);
+ lcd.cls();
+ lcd.printf(" * Relax * ");
+ wait(5);
+ lcd.cls();
+ lcd.printf(" * Stretch * ");
+ wait(4);
+ lcd.cls();
+ }
+
+ if(Sensor.read_u16()>46000 && Sensor.read_u16()< 48000){
+ lcd.printf(" * left * ");
+ wait(1);
+ lcd.cls();
+ }
+
+ if(Sensor.read_u16()>30000 && Sensor.read_u16()< 32000){
+ lcd.printf(" * down * ");
+ wait(1);
+ lcd.cls();
+ }
+
+ if(Sensor.read_u16()>0 && Sensor.read_u16()< 10000){
+ lcd.printf(" * right * ");
+ wait(1);
+ lcd.cls();
+ }
+
+ else {
+ lcd.printf("Press to start", Sensor.read_u16());
+ wait(1);
+ lcd.cls();
+ }
+
+
+ }
+
+}