This program is a PWM which varies the dutty cycle by the touchpad of FRDM KL25Z. We can observe the result with the variation of RGBled intensity
main.cpp
00001 #include "mbed.h" 00002 #include "TSISensor.h" 00003 00004 int main(void) { 00005 PwmOut led(LED_GREEN); 00006 PwmOut Salida(PTD4); 00007 TSISensor tsi; 00008 00009 while (true) { 00010 if (tsi.readPercentage()!=0) // Asignacion de Luminosidad del led 00011 { 00012 led = 1.0 - tsi.readPercentage(); // Coordenadas del la asignacion del led 00013 Salida=1.0 - tsi.readPercentage(); 00014 wait(0.1); // Tiempo de es espera para retomar el ciclo 00015 00016 } 00017 } 00018 }
Generated on Sun Jul 31 2022 07:01:44 by 1.7.2