Lectura del slider al LCD de la tarjeta

Dependencies:   mbed tsi_sensor TextLCD SLCD

Committer:
ArturoSoto
Date:
Thu May 02 18:31:31 2019 +0000
Revision:
3:a7b991611a74
Parent:
2:ad0b044d0a10
LCD_De_Tarjeta

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ArturoSoto 3:a7b991611a74 1 #include "mbed.h"
ArturoSoto 3:a7b991611a74 2 #include "SLCD.h"
ArturoSoto 3:a7b991611a74 3 #include "tsi_sensor.h"
ArturoSoto 3:a7b991611a74 4 BusOut Salidas(PTE16, PTE17, PTE18, PTE19, PTE20, PTE21, PTE22, PTE23);
ArturoSoto 3:a7b991611a74 5 uint8_t Segmentos[]={0x81, 0xE7, 0x49, 0x43, 0x27, 0x13, 0x11, 0xC7, 0x01, 0x03, 0x05, 0x31, 0x99, 0x61, 0x19, 0x1D, 0x91, 0x35, 0xBD, 0xB3, 0x2D, 0xB9, 0x85, 0x75, 0x71, 0x0D, 0x07, 0x3D, 0x13, 0x39, 0xF1, 0xE1, 0xA1, 0x25, 0x37, 0x49};
ArturoSoto 3:a7b991611a74 6 SLCD slcd;
ArturoSoto 3:a7b991611a74 7 TSIAnalogSlider slider(PTB16, PTB17, 100); // touch sensor
simon 1:7418a52375a0 8
ArturoSoto 3:a7b991611a74 9 PwmOut gLed(LED_GREEN); // pwm out
ArturoSoto 3:a7b991611a74 10 PwmOut rLed(LED_RED);
simon 0:334327d1a416 11
ArturoSoto 3:a7b991611a74 12 int main()
ArturoSoto 3:a7b991611a74 13 {
ArturoSoto 3:a7b991611a74 14 slcd.printf("lcd ");
ArturoSoto 3:a7b991611a74 15 wait(2); // delay 2 sec
simon 0:334327d1a416 16
ArturoSoto 3:a7b991611a74 17 while (1)
ArturoSoto 3:a7b991611a74 18 {
ArturoSoto 3:a7b991611a74 19 slcd.CharPosition = 0;
ArturoSoto 3:a7b991611a74 20 //Salidas=Segmentos[]; // if we don't use it the value on the screen will be sliding
ArturoSoto 3:a7b991611a74 21 slcd.printf("%1.3f",slider.readPercentage()); // print TSI_sensor value on LCD
ArturoSoto 3:a7b991611a74 22 rLed = slider.readPercentage(); // set TSI_value to the PWM linked with LED
ArturoSoto 3:a7b991611a74 23 gLed = 1.0 - slider.readPercentage();
ArturoSoto 3:a7b991611a74 24 wait_ms(10);
ArturoSoto 3:a7b991611a74 25 }
ArturoSoto 3:a7b991611a74 26 }