Jan Kamidra
/
DAC_MCP4801_example
Simple example
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 #include "MCP4801.h" 00003 00004 SPI spi(PA_7,PA_6,PA_5);//tested on Nucleo L432KC 00005 MCP4801 dac(spi,PA_4); 00006 DigitalOut led(LED2); 00007 00008 int main(void) { 00009 printf("DAC MCP4801 example starting...\n"); 00010 00011 00012 float voltage = 2.8; 00013 dac.setVOutput(voltage); 00014 printf("Your request was %4.2fV\n", voltage); 00015 00016 while(1){ 00017 led = !led; 00018 ThisThread::sleep_for(500); 00019 } 00020 }
Generated on Mon Jul 18 2022 01:01:26 by 1.7.2