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 3:0143415767e4, committed 2015-03-19
- Comitter:
- nxp_ip
- Date:
- Thu Mar 19 10:36:13 2015 +0000
- Parent:
- 2:b8c6902f2ff7
- Commit message:
- Correction of comment. To include latest library
Changed in this revision
| PCA9632.lib | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/PCA9632.lib Wed Mar 04 08:38:06 2015 +0000 +++ b/PCA9632.lib Thu Mar 19 10:36:13 2015 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/users/nxp_ip/code/PCA9632/#32308cbf7e68 +http://developer.mbed.org/users/nxp_ip/code/PCA9632/#3574bf73abf5
--- a/main.cpp Wed Mar 04 08:38:06 2015 +0000
+++ b/main.cpp Thu Mar 19 10:36:13 2015 +0000
@@ -2,7 +2,8 @@
#include "PCA9632.h"
PCA9632 led_cntlr( p28, p27, 0xC4 ); // SDA, SCL, Slave_address(option)
-LedPwmOut led( led_cntlr, L0 ); // for LED0 pin
+LedPwmOut led0( led_cntlr, L0 ); // for LED0 pin
+LedPwmOut led1( led_cntlr, L1 ); // for LED0 pin
int main()
{
@@ -18,27 +19,35 @@
//
while ( 1 ) {
-
+
//
// 1st sample is using LedPwmOut API.
// PWM control via LedPwmOut
//
for ( int i = 0; i < 3; i++ ) {
for( float p = 0.0f; p < 1.0f; p += 0.01f ) {
- led = p; // Controls LED0 pin
+ led0 = p; // Controls LED0 pin
+ led1 = 1.0 - p; // Controls LED1 pin
wait( 0.01 );
}
}
+ led0 = 0.0;
+ led1 = 0.0;
+
//
// 2nd sample is using PCA9632 class function.
// PWM control by device class function call
//
for ( int i = 0; i < 3; i++ ) {
for( float p = 0.0f; p < 1.0f; p += 0.01f ) {
- led_cntlr.pwm( 3, p ); // Controls LED1 pin
+ led_cntlr.pwm( 2, p ); // Controls LED2 pin
+ led_cntlr.pwm( 3, 1.0 - p ); // Controls LED3 pin
wait( 0.01 );
}
}
+
+ led_cntlr.pwm( 2, 0.0 );
+ led_cntlr.pwm( 3, 0.0 );
}
}
PCA9632 : 4ch LED driver (voltage switch type)