pwm con touchpad

Dependencies:   TSI TextLCD3 mbed

main.cpp

Committer:
caaruizze
Date:
2013-12-12
Revision:
0:6dadccd599a2

File content as of revision 0:6dadccd599a2:

#include "mbed.h"
#include "TSISensor.h"
#include "TextLCD.h"
 
PwmOut led(LED1);
PwmOut led2(PTA5);

TextLCD lcd(PTB10,PTB11,PTE2,PTE3,PTE4,PTE5);
 
float a = 0.0;
float l;
int main() {
led.period(0.02); 
led2.period(0.02);         
       
TSISensor tsi;

float b = 0.0;

    while(1) {
       a = tsi.readPercentage();
       if (tsi.readPercentage()){
       l = a;
       }
      
       b = 0.001 + (l);// ancho de pulso
      
       
        // servo position determined by a pulsewidth between 1-2ms
        
        led = 1.0 - l; 
        led2 = 1.0 - l;
        lcd.locate(0,0);      //localizar en la columna, fila de la LCD
        lcd.printf("med:%0.3f", a);
        lcd.locate(9,0);      //localizar en la columna, fila de la LCD
        lcd.printf("p(ms):%d", 20);
        lcd.locate(0,1);      //localizar en la columna, fila de la LCD
        lcd.printf("D:%0.3f", b);
        wait(0.25);
    }  
}