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.
Dependents: gimbalController_brushless_IMU i2c_MPU6050 i2c_HMC5883L IMU_fusion ... more
Revision 0:0afc4bd76407, committed 2015-07-09
- Comitter:
- BaserK
- Date:
- Thu Jul 09 12:14:46 2015 +0000
- Child:
- 1:7ffaf6e46589
- Commit message:
- v1.0
Changed in this revision
| ledControl.cpp | Show annotated file Show diff for this revision Revisions of this file |
| ledControl.h | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ledControl.cpp Thu Jul 09 12:14:46 2015 +0000
@@ -0,0 +1,44 @@
+#include "ledControl.h"
+
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+DigitalOut led3(LED3);
+DigitalOut led4(LED4);
+
+// Controls the 4 LEDs on the LPC1768
+void ledControl(int ledNum,int value)
+{
+ switch(ledNum)
+ {
+ case 1: led1.write(value);
+ break;
+
+ case 2: led2.write(value);
+ break;
+
+ case 3: led3.write(value);
+ break;
+
+ case 4: led4.write(value);
+ break;
+ }
+}
+
+// Toggles the specified led
+void ledToggle(int ledNum)
+{
+ switch(ledNum)
+ {
+ case 1: led1=!led1;
+ break;
+
+ case 2: led2=!led2;
+ break;
+
+ case 3: led3=!led3;
+ break;
+
+ case 4: led4=!led4;
+ break;
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ledControl.h Thu Jul 09 12:14:46 2015 +0000 @@ -0,0 +1,14 @@ +#ifndef LEDCONTROL_H // "if not defined": to ensure that header code is only ever included once by the linker. +#define LEDCONTROL_H + +#include "mbed.h" + +extern DigitalOut led1; // allow led1 to be manipulated by other files +extern DigitalOut led2; +extern DigitalOut led3; +extern DigitalOut led4; + +void ledControl(int ledNum,int value); // function prototype +void ledToggle(int ledNum); + +#endif