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.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 2:66a393e95664
- Parent:
- 0:cb7457d7c822
--- a/main.cpp Mon Feb 24 13:09:19 2020 +0000
+++ b/main.cpp Mon Feb 24 13:41:54 2020 +0000
@@ -1,12 +1,27 @@
#include "mbed.h"
+/****************************************************************
+In this exercise I would like you to make two very simple functions:
+the first function should set all the led's on (this is done by making led = 1;)
+the second function should set all the led's off (this is done by makeing led = 0;)
+the two functions should be called "AllOn" and "AllOff" respectivly.
+
+In the main function should have a while 1 loop (google if don;'t know) and blink all the leds on and off using your new functions
+(use a function called wait(1); to creat a 1 second interval)
-DigitalOut myled(LED1);
+good luck!
+***************************************************************/
+// these functions initializes the led pins and functions associated with them these are technically c++ but dont worry to much about this yet
+DigitalOut led1(D5);
+DigitalOut led2(D6);
+DigitalOut led3(D7);
+DigitalOut led4(D8);
+DigitalOut led5(D9);
+DigitalOut led6(D10);
+DigitalOut led7(D11);
+DigitalOut led8(D12);
+
+// this is your main function and is where the code starts good luck!
int main() {
- while(1) {
- myled = 1; // LED is ON
- wait(0.2); // 200 ms
- myled = 0; // LED is OFF
- wait(1.0); // 1 sec
- }
+
}