Simple example

Dependencies:   MCP4801DAC

Files at this revision

API Documentation at this revision

Comitter:
JohnnyK
Date:
Tue Mar 03 20:10:21 2020 +0000
Commit message:
First release

Changed in this revision

MCP4801DAC.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-os.lib Show annotated file Show diff for this revision Revisions of this file
mbed_app.json Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r da546cd98789 MCP4801DAC.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MCP4801DAC.lib	Tue Mar 03 20:10:21 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/JohnnyK/code/MCP4801DAC/#886b1ee1370b
diff -r 000000000000 -r da546cd98789 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Mar 03 20:10:21 2020 +0000
@@ -0,0 +1,20 @@
+#include "mbed.h"
+#include "MCP4801.h"
+
+SPI spi(PA_7,PA_6,PA_5);//tested on Nucleo L432KC
+MCP4801 dac(spi,PA_4);
+DigitalOut led(LED2);
+
+int main(void) {
+    printf("DAC MCP4801 example starting...\n");
+ 
+    
+    float voltage = 2.8;
+    dac.setVOutput(voltage);
+    printf("Your request was %4.2fV\n", voltage);
+
+    while(1){
+        led = !led;
+        ThisThread::sleep_for(500);
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r da546cd98789 mbed-os.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Tue Mar 03 20:10:21 2020 +0000
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/mbed-os/#c12b433026beae5b3b769c27941bc6d7fe5d4b27
diff -r 000000000000 -r da546cd98789 mbed_app.json
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed_app.json	Tue Mar 03 20:10:21 2020 +0000
@@ -0,0 +1,3 @@
+{
+    "requires": ["bare-metal", "rtos-api"]
+}