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
main.cpp@2:66a393e95664, 2020-02-24 (annotated)
- Committer:
- drewantech
- Date:
- Mon Feb 24 13:41:54 2020 +0000
- Revision:
- 2:66a393e95664
- Parent:
- 0:cb7457d7c822
Exercise 1;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| drewantech | 0:cb7457d7c822 | 1 | #include "mbed.h" |
| drewantech | 2:66a393e95664 | 2 | /**************************************************************** |
| drewantech | 2:66a393e95664 | 3 | In this exercise I would like you to make two very simple functions: |
| drewantech | 2:66a393e95664 | 4 | the first function should set all the led's on (this is done by making led = 1;) |
| drewantech | 2:66a393e95664 | 5 | the second function should set all the led's off (this is done by makeing led = 0;) |
| drewantech | 2:66a393e95664 | 6 | the two functions should be called "AllOn" and "AllOff" respectivly. |
| drewantech | 2:66a393e95664 | 7 | |
| drewantech | 2:66a393e95664 | 8 | 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 |
| drewantech | 2:66a393e95664 | 9 | (use a function called wait(1); to creat a 1 second interval) |
| drewantech | 0:cb7457d7c822 | 10 | |
| drewantech | 2:66a393e95664 | 11 | good luck! |
| drewantech | 2:66a393e95664 | 12 | ***************************************************************/ |
| drewantech | 0:cb7457d7c822 | 13 | |
| drewantech | 2:66a393e95664 | 14 | // these functions initializes the led pins and functions associated with them these are technically c++ but dont worry to much about this yet |
| drewantech | 2:66a393e95664 | 15 | DigitalOut led1(D5); |
| drewantech | 2:66a393e95664 | 16 | DigitalOut led2(D6); |
| drewantech | 2:66a393e95664 | 17 | DigitalOut led3(D7); |
| drewantech | 2:66a393e95664 | 18 | DigitalOut led4(D8); |
| drewantech | 2:66a393e95664 | 19 | DigitalOut led5(D9); |
| drewantech | 2:66a393e95664 | 20 | DigitalOut led6(D10); |
| drewantech | 2:66a393e95664 | 21 | DigitalOut led7(D11); |
| drewantech | 2:66a393e95664 | 22 | DigitalOut led8(D12); |
| drewantech | 2:66a393e95664 | 23 | |
| drewantech | 2:66a393e95664 | 24 | // this is your main function and is where the code starts good luck! |
| drewantech | 0:cb7457d7c822 | 25 | int main() { |
| drewantech | 2:66a393e95664 | 26 | |
| drewantech | 0:cb7457d7c822 | 27 | } |