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.
12 years, 8 months ago.
Serial communication with PC Led brightness not functioning
I am a raw newbie trying to get a handle on issues related to serial communication, and so I downloaded another mbed example from the Serial Communication with PC section of the handbook. Here is the code:
- 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; }
} }
After the compile and download, in the terminal program the "Press 'u' to turn...." is displayed, and each press on the keyboard on my laptop causes a flicker on the mbed circuit board, but the brightness of the LED is unaffected.
Can someone explain why the LED remains bright all the time and does not do what is expected?
1 Answer
12 years, 8 months ago.
Hi Tom, what board are you using? I have the same code for the LPC1768 and works great. Have you have installed the mbed serial driver for Windows?
Greetings
Thanks for responding. I have a FRDM KL25Z. Now the mbed does not seem to be accepting any downloads at all. Yes, I installed the mbed serial driver. I tried holding the reset button down and powering off and on, but it is not responding to any compile and downloads now at all. How frustrating.
posted by 28 Mar 2013Hi, tom this link maybe help you to try to repair your board http://mbed.org/cookbook/deadmbed
The example works for LPC1768 board but i think there is not LED1 in the FRDM KL25Z according to the schematics. Maybe for that doesnt work.
Greetings
posted by 28 Mar 2013