very simple 4ch PWM output demo for "mbed LPC824"

Dependencies:   mbed

main.cpp

Committer:
nxpfan
Date:
2014-12-17
Revision:
0:a7f40d4e5c58

File content as of revision 0:a7f40d4e5c58:

#include "mbed.h"

#define     PI          3.14159265

PwmOut pwm[]    = {
    PwmOut( dp6 ),
    PwmOut( dp7 ),
    PwmOut( dp8 ),
    PwmOut( dp9 ),
};

int main()
{
    int     count   = 0;
    float   t       = PI / 40.0;

    while(1) {
        for ( int i = 0; i < 4; i++ ) {
            pwm[ 0 ]    = powf( sin( t * (float)(count +  0) ), 2.0 );
            pwm[ 1 ]    = powf( sin( t * (float)(count +  5) ), 2.0 );
            pwm[ 2 ]    = powf( sin( t * (float)(count + 10) ), 2.0 );
            pwm[ 3 ]    = powf( sin( t * (float)(count + 15) ), 2.0 );
        }
        wait_ms( 20 );
        count++;
    }
}