Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Task136 by
Diff: main.cpp
- Revision:
- 2:12fb933ccc6d
- Parent:
- 0:6637f9cf2dc0
- Child:
- 3:c28e88869b5a
--- a/main.cpp Thu Jul 13 14:47:15 2017 +0000 +++ b/main.cpp Wed Sep 11 13:46:00 2019 +0000 @@ -1,18 +1,24 @@ #include "mbed.h" -PwmOut mypwm(PWM_OUT); +Serial pc(SERIAL_TX, SERIAL_RX); -DigitalOut myled(LED1); +DigitalOut greenLed(LED1,0); +DigitalOut blueLed(LED2,0); +DigitalOut redLed(LED3,0); int main() { + char nameString[30]; + int age; - mypwm.period_ms(10); - mypwm.pulsewidth_ms(1); - - printf("pwm set to %.2f %%\n", mypwm.read() * 100); + pc.printf("Enter your first name, then a space, then your age\n\r"); + pc.scanf("%s %d", nameString, &age); + pc.printf("Hello %s\n\r", nameString); + pc.printf("You are %d years old\n\r", age); - while(1) { - myled = !myled; - wait(1); - } + //Loop forever + redLed = 1; + blueLed = 1; + greenLed = 1; + while(1); } +