MCP4018 sample

Dependencies:   AQM0802 MCP4018 mbed

See https://developer.mbed.org/users/yasuyuki/notebook/MCP4018/

Files at this revision

API Documentation at this revision

Comitter:
yasuyuki
Date:
Sat Nov 08 12:16:57 2014 +0000
Commit message:
release

Changed in this revision

AQM0802.lib Show annotated file Show diff for this revision Revisions of this file
MCP4018.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
diff -r 000000000000 -r b111edfe05a5 AQM0802.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/AQM0802.lib	Sat Nov 08 12:16:57 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/yasuyuki/code/AQM0802/#6fa303916aa8
diff -r 000000000000 -r b111edfe05a5 MCP4018.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MCP4018.lib	Sat Nov 08 12:16:57 2014 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/yasuyuki/code/MCP4018/#f32b8e382343
diff -r 000000000000 -r b111edfe05a5 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Nov 08 12:16:57 2014 +0000
@@ -0,0 +1,44 @@
+//**********************
+// potension registor with 7bits
+// MCP4018 sample for mbed
+//
+// (C)Copyright 2014 All rights reserved by Y.Onodera
+// http://einstlab.web.fc2.com
+//**********************
+#include "mbed.h"
+#include "AQM0802.h"
+#include "MCP4018.h"
+
+#if defined(TARGET_LPC1768)
+I2C i2c(p28,p27);
+#endif
+// for TG-LPC11U35-501
+#if defined(TARGET_LPC11U35_501)
+I2C i2c(P0_5,P0_4);
+#endif
+// for Nucleo
+#if defined(TARGET_NUCLEO_F401RE)
+I2C i2c(D14,D15);
+#endif
+AQM0802 lcd(i2c);
+MCP4018 mcp4018(i2c);
+
+
+int main() {
+    
+    char msg[10];
+    unsigned char i;
+    
+    while(1){
+        for(i=0;i<0x80;i++){
+            mcp4018.put(i);
+            sprintf(msg, "%5dOhm" , 10000/127*i+75 );
+            lcd.locate(0,0);
+            lcd.print(msg);
+            wait(1);
+        }
+    }
+
+}
+
+
diff -r 000000000000 -r b111edfe05a5 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Nov 08 12:16:57 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/031413cf7a89
\ No newline at end of file