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.
Revision 0:a9b292f972a1, committed 2016-02-02
- Comitter:
- chadlewellyn
- Date:
- Tue Feb 02 05:55:07 2016 +0000
- Commit message:
- lab2 part 3
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r a9b292f972a1 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Tue Feb 02 05:55:07 2016 +0000
@@ -0,0 +1,29 @@
+#include "mbed.h"
+
+DigitalOut myled[4] = {LED1, LED2, LED3,LED4}; // array of digitalouts of mbed LEDs
+
+
+int main()
+{
+
+ int num = 0; // initialize variables
+ int i = 0;
+
+ while(1) {
+ printf("Enter a Number"); // Tells user to enter number
+ scanf("%d",&num); // scans for number
+
+ if((num >= 1) && (num <=4)) { // if number is 1-4
+ i = num - 1; // light corresponding LED
+ myled[i] = 1;
+ }
+
+ else {
+ myled[0] = 0; // if not turn of all LEDs
+ myled[1] = 0;
+ myled[2] = 0;
+ myled[3] = 0;
+
+ }
+ }
+}
diff -r 000000000000 -r a9b292f972a1 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Feb 02 05:55:07 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/6f327212ef96 \ No newline at end of file