Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 5 months ago.
Serial PC Example (PWM)
Hello.
Not running Ex.
I use u-blox c027 board.
I can't controlled brightness on LED.
Whats the Problem here?
Thank you.
[Examples] Connect to your mbed Microcontroller with a Terminal program and uses the 'u' and 'd' keys to make LED1 brighter or dimmer
#include "mbed.h" Serial pc(USBTX, USBRX); // tx, rx PwmOut led(LED1); float brightness = 0.0; int main() { pc.printf("Press 'u' to turn LED1 brightness up, 'd' to turn it down\n"); while(1) { char c = pc.getc(); if((c == 'u') && (brightness < 0.5)) { brightness += 0.01; led = brightness; } if((c == 'd') && (brightness > 0.0)) { brightness -= 0.01; led = brightness; } } }
Do you receive the initial printf? Or another one?
posted by Erik - 02 Jul 2014I received the initial printf. but, press 'u' or 'd' >> LED not change.
I'm sorry because short of English skill
posted by jeong dearo 04 Jul 2014