University of Plymouth - Stages 1, 2 and 3 / Mbed OS Task136

Fork of Task136 by Nicholas Outram

Committer:
noutram
Date:
Wed Sep 11 14:19:45 2019 +0000
Revision:
3:c28e88869b5a
Parent:
2:12fb933ccc6d
2019

Who changed what in which revision?

UserRevisionLine numberNew contents of line
noutram 0:6637f9cf2dc0 1 #include "mbed.h"
noutram 0:6637f9cf2dc0 2
noutram 2:12fb933ccc6d 3 Serial pc(SERIAL_TX, SERIAL_RX);
noutram 0:6637f9cf2dc0 4
noutram 0:6637f9cf2dc0 5 int main() {
noutram 2:12fb933ccc6d 6 char nameString[30];
noutram 2:12fb933ccc6d 7 int age;
noutram 0:6637f9cf2dc0 8
noutram 2:12fb933ccc6d 9 pc.printf("Enter your first name, then a space, then your age\n\r");
noutram 2:12fb933ccc6d 10 pc.scanf("%s %d", nameString, &age);
noutram 2:12fb933ccc6d 11 pc.printf("Hello %s\n\r", nameString);
noutram 2:12fb933ccc6d 12 pc.printf("You are %d years old\n\r", age);
noutram 0:6637f9cf2dc0 13
noutram 2:12fb933ccc6d 14 //Loop forever
noutram 2:12fb933ccc6d 15 while(1);
noutram 0:6637f9cf2dc0 16 }
noutram 2:12fb933ccc6d 17