this simple program is an example to let u know how the ADC can be enabled in w7500

Dependencies:   mbed

main.cpp

Committer:
shia
Date:
2016-05-24
Revision:
1:6b3079b2bfcc
Parent:
0:60d6189b9b0d

File content as of revision 1:6b3079b2bfcc:

#include "mbed.h"
AnalogIn Current(A0);
PwmOut led(D9);
int meas,i,max,a[10];
float curren=0;
int wattage;
void led_toggle(int chan, uint32_t value)
{
    led = !led;
}


int main()
{
    printf("\n GSAS Micro Systems \r\n");
    
    wait(0.1f);
    while(1){
    meas = Current.read_u16();
    printf("value = %d\r\n", meas);
    curren = (meas - 2595) / 185;
    printf("curren = %.2f\r\n", curren);
    wattage = curren * 230;
    printf("wattage = %d\r\n", wattage);
   wait(0.5f) ;
    }
    

    }