yellow bee
/
Nucleo_blink_led2
test2
Fork of Nucleo_blink_led1 by
main.cpp
- Committer:
- yellowBee
- Date:
- 2016-09-06
- Revision:
- 1:33d68bd4c493
- Parent:
- 0:9d596b5ec030
File content as of revision 1:33d68bd4c493:
#include "mbed.h" /* DigitalOut myled(LED1); int main() { while(1) { myled = 1; // LED is ON wait(0.2); // 200 ms myled = 0; // LED is OFF wait(1.0); // 1 sec } } Serial pc(USBTX, USBRX); // tx, rx int main() { pc.printf("Hello World!\n"); while(1); } Serial pc(USBTX, USBRX); int main() { pc.printf("Echoes back to the screen anything you type\n"); while(1) { pc.putc(pc.getc()); } } */ 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; } } }