![](/media/cache/profiles/aa2ecd855649906462f4ed8ccc6cd84b.jpg.50x50_q85.jpg)
mbed PCF8591 I2C ADC Read program for LPC11U24
Dependencies: PCF8591_ADC_LPC11U24_Rajesh_NIELIT_Calicut mbed
main.cpp@0:70461019ca89, 2016-06-15 (annotated)
- Committer:
- rajeshnielit
- Date:
- Wed Jun 15 21:48:30 2016 +0000
- Revision:
- 0:70461019ca89
mbed PCF8591 I2C ADC Read program for LPC11U24
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rajeshnielit | 0:70461019ca89 | 1 | /*RAJESH M , NIELIT Calicut, rajesh@calicut.nielit.in |
rajeshnielit | 0:70461019ca89 | 2 | PCF8591 ADC usage |
rajeshnielit | 0:70461019ca89 | 3 | myadc.ADC_read(ADC_CHxx); replace xx with 00 , 01 , 02 , 03 for reading from |
rajeshnielit | 0:70461019ca89 | 4 | different channels*/ |
rajeshnielit | 0:70461019ca89 | 5 | |
rajeshnielit | 0:70461019ca89 | 6 | #include "mbed.h" |
rajeshnielit | 0:70461019ca89 | 7 | #include "PCF8591.h" |
rajeshnielit | 0:70461019ca89 | 8 | I2C i2c(p28,p27); /* sda and scl*/ |
rajeshnielit | 0:70461019ca89 | 9 | PCF8591 myadc(&i2c); |
rajeshnielit | 0:70461019ca89 | 10 | Serial pc(USBTX,USBRX); |
rajeshnielit | 0:70461019ca89 | 11 | |
rajeshnielit | 0:70461019ca89 | 12 | |
rajeshnielit | 0:70461019ca89 | 13 | int main() { |
rajeshnielit | 0:70461019ca89 | 14 | |
rajeshnielit | 0:70461019ca89 | 15 | while(1) { |
rajeshnielit | 0:70461019ca89 | 16 | wait(3); |
rajeshnielit | 0:70461019ca89 | 17 | pc.printf("read=%x\r\n",myadc.ADC_read(ADC_CH00)); |
rajeshnielit | 0:70461019ca89 | 18 | } |
rajeshnielit | 0:70461019ca89 | 19 | |
rajeshnielit | 0:70461019ca89 | 20 | |
rajeshnielit | 0:70461019ca89 | 21 | |
rajeshnielit | 0:70461019ca89 | 22 | } |