Christian Lerche
/
MCP4822_HelloWorld
Runs through some voltages
Revision 0:9921e2758bd8, committed 2011-01-21
- Comitter:
- Lerche
- Date:
- Fri Jan 21 10:58:43 2011 +0000
- Commit message:
- Example program for MCP4822
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MCP4822.lib Fri Jan 21 10:58:43 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/Lerche/code/MCP4822/#96eff565b2c0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Jan 21 10:58:43 2011 +0000 @@ -0,0 +1,18 @@ +#include "mbed.h" +#include "MCP4822.h" + +MCP4822 MCP(p5, p7, p8); // MOSI, SCLK, nCS + +int main() { + while(1){ + MCP.writeA(1650); // 1650 V out + MCP.writeB(1650); // Same on B output + wait(5); + MCP.writeA(0); // Zero v out + MCP.writeB(0); // Same on B + wait(5); + MCP.writeA(3300); // Guess what? + MCP.writeB(3300); // 3.3 V + wait(5); + } // Return to beginning. +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Jan 21 10:58:43 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e