Mahandra Raditya / Mbed 2 deprecated LCDKEYPADTEST2

Dependencies:   TextLCD mbed

main.cpp

Committer:
Sunastra
Date:
2017-11-02
Revision:
0:68fe010d5a55

File content as of revision 0:68fe010d5a55:


// 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();
            }
                   
                                        
        }

}