Artem Mishchenko / Mbed 2 deprecated MCP4822_2aLerche

Dependencies:   mbed-STM32F103C8T6 mbed

Fork of STM32F103C8T6_USBSerial by Zoltan Hudak

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "stm32f103c8t6.h"
00002 #include "mbed.h" 
00003 #include "MCP4822.h"
00004 
00005 MCP4822 MCP(SPI_MOSI, SPI_SCK, SPI_CS);    // MOSI, SCLK, nCS
00006 
00007 int main() {                
00008     while(1){
00009     MCP.writeA(1650);       // 1650 V out
00010     MCP.writeB(1650);       // Same on B output
00011     wait(5);
00012     MCP.writeA(0);          // Zero v out
00013     MCP.writeB(0);          // Same on B
00014     wait(5);
00015     MCP.writeA(3300);       // Guess what? 
00016     MCP.writeB(3300);       // 3.3 V
00017     wait(5);
00018     }                       // Return to beginning. 
00019 }