
first commit
main.cpp
- Committer:
- t00221549
- Date:
- 2021-08-08
- Revision:
- 0:28a7761e2484
File content as of revision 0:28a7761e2484:
#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 \r\n"); while(1) { char c = pc.getc(); if((c == 'u') && (brightness < 0.5)) { pc.putc('^'); brightness += 0.01; led = brightness; } if((c == 'd') && (brightness > 0.0)) { pc.putc('v'); brightness -= 0.01; led = brightness; } } }