![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
524APP
Fork of Post_2 by
Diff: main.cpp
- Revision:
- 0:c0bf253f46e0
- Child:
- 1:a100355f82ff
diff -r 000000000000 -r c0bf253f46e0 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu May 24 11:20:14 2018 +0000 @@ -0,0 +1,32 @@ +#include "mbed.h" + +DigitalOut led(LED2); +SPI spi(D11, D12, D13); // mosi, miso, sclk +DigitalOut CS(D8); + +Serial pc(PC_6, PC_7); + +int main() { + // specify period first + led = 1; + spi.format(8,3); + spi.frequency(2000000); + CS = 1; + + pc.baud(2000000); + + while(1) + { + //CS = 0; + //spi.write(0x8F); + //spi.write(0x00); + //CS = 1; + pc.printf("5"); + + } + // 4 second period + //led.write(0.5f); // 50% duty cycle, relative to period + //led = 0.5f; // shorthand for led.write() + //led.pulsewidth(2); // alternative to led.write, set duty cycle time in seconds + //while(1); +} \ No newline at end of file