test PCF

Dependencies:   PCF8591 mbed

Files at this revision

API Documentation at this revision

Comitter:
fblanc
Date:
Tue Jul 22 13:32:47 2014 +0000
Child:
1:e148be668cc9
Commit message:
test OK

Changed in this revision

PCF8591.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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PCF8591.lib	Tue Jul 22 13:32:47 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/wim/code/PCF8591/#1116b0d151fc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Jul 22 13:32:47 2014 +0000
@@ -0,0 +1,33 @@
+ #include "mbed.h"
+ #include "PCF8591.h"
+ #define VERSION "21_07_2014"
+ #define CIBLE "KL25Z"
+ // I2C Communication
+  I2C i2c_adcdac(PTC9,PTC8); // SDA, SCL for LPC1768
+  //I2C i2c_adcdac(P0_10,P0_11); // SDA, SCL for LPC812
+ 
+  //Declare a composite ADC and DAC device that may be used through public methods
+  PCF8591 capteur0(&i2c_adcdac,PCF8591_SA0); // I2C bus, Default PCF8591 Slaveaddress
+ 
+  //Declare independent ADC and DAC objects that may be used similar to mbed AnalogIn and AnalogOut pins
+  //PCF8591_AnalogOut anaOut(&i2c_bus);
+  //
+  //PCF8591_AnalogIn anaIn(&i2c_bus, PCF8591_ADC0);
+ 
+  
+  int main() {
+    uint8_t count = 0; 
+    uint8_t analog;  
+    printf("LAAS-CNRS ,PCF8591 ,%s ,%s\r\n",CIBLE,VERSION);
+    while(1) {
+      wait(1);    
+      count++;       
+ 
+      // Composite device methods    
+     capteur0.write(count);                 // write D/A value
+     analog = capteur0.read(PCF8591_ADC0);  // read A/D value for Channel 0
+printf("AO=%d AI=%d \r\n",count,analog);
+              // read A/D value for Channel 0 in (Volts*10)
+  }
+ 
+ }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Jul 22 13:32:47 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/04dd9b1680ae
\ No newline at end of file