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.
Led.cpp@0:b43794060b94, 2015-10-15 (annotated)
- Committer:
- GGHHHH
- Date:
- Thu Oct 15 10:38:34 2015 +0000
- Revision:
- 0:b43794060b94
- Child:
- 6:f804bb3faa26
Created library
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| GGHHHH | 0:b43794060b94 | 1 | #include "Led.h" //includes the header with the class definition |
| GGHHHH | 0:b43794060b94 | 2 | |
| GGHHHH | 0:b43794060b94 | 3 | //constructor |
| GGHHHH | 0:b43794060b94 | 4 | Led::Led(string s) //contructor implementation |
| GGHHHH | 0:b43794060b94 | 5 | { |
| GGHHHH | 0:b43794060b94 | 6 | if(s== "red") |
| GGHHHH | 0:b43794060b94 | 7 | pin= PD_14; //The pin for the red led |
| GGHHHH | 0:b43794060b94 | 8 | |
| GGHHHH | 0:b43794060b94 | 9 | l = new DigitalOut(pin); |
| GGHHHH | 0:b43794060b94 | 10 | } |
| GGHHHH | 0:b43794060b94 | 11 | |
| GGHHHH | 0:b43794060b94 | 12 | void Led::On() //function implementation |
| GGHHHH | 0:b43794060b94 | 13 | { |
| GGHHHH | 0:b43794060b94 | 14 | l->write(1); //set the value of the pin to l |
| GGHHHH | 0:b43794060b94 | 15 | } |
| GGHHHH | 0:b43794060b94 | 16 | |
| GGHHHH | 0:b43794060b94 | 17 | void Led::Off() |
| GGHHHH | 0:b43794060b94 | 18 | { |
| GGHHHH | 0:b43794060b94 | 19 | l->write(0); //set the value of the pin to 0 |
| GGHHHH | 0:b43794060b94 | 20 | } |