aaa
Dependencies: mbed-STM32F103C8T6 mbed
Fork of STM32F103C8T6_USBSerial by
main.cpp@6:d3175b589df4, 2018-02-19 (annotated)
- Committer:
- artembio
- Date:
- Mon Feb 19 11:52:44 2018 +0000
- Revision:
- 6:d3175b589df4
- Parent:
- 5:0be85f1bdb35
aaa
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hudakz | 0:0279e8c1f111 | 1 | #include "stm32f103c8t6.h" |
artembio | 6:d3175b589df4 | 2 | #include "mbed.h" |
artembio | 6:d3175b589df4 | 3 | #include "MCP4822.h" |
hudakz | 0:0279e8c1f111 | 4 | |
artembio | 6:d3175b589df4 | 5 | MCP4822 MCP(SPI_MOSI, SPI_SCK, SPI_CS); // MOSI, SCLK, nCS |
hudakz | 0:0279e8c1f111 | 6 | |
artembio | 6:d3175b589df4 | 7 | int main() { |
artembio | 6:d3175b589df4 | 8 | while(1){ |
artembio | 6:d3175b589df4 | 9 | MCP.writeA(1650); // 1650 V out |
artembio | 6:d3175b589df4 | 10 | MCP.writeB(1650); // Same on B output |
artembio | 6:d3175b589df4 | 11 | wait(5); |
artembio | 6:d3175b589df4 | 12 | MCP.writeA(0); // Zero v out |
artembio | 6:d3175b589df4 | 13 | MCP.writeB(0); // Same on B |
artembio | 6:d3175b589df4 | 14 | wait(5); |
artembio | 6:d3175b589df4 | 15 | MCP.writeA(3300); // Guess what? |
artembio | 6:d3175b589df4 | 16 | MCP.writeB(3300); // 3.3 V |
artembio | 6:d3175b589df4 | 17 | wait(5); |
artembio | 6:d3175b589df4 | 18 | } // Return to beginning. |
artembio | 6:d3175b589df4 | 19 | } |