
SPIWithSTM32F4
Diff: main.cpp
- Revision:
- 0:ce4f87a989a6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Feb 09 18:16:28 2016 +0000 @@ -0,0 +1,25 @@ +#include "mbed.h" + +SPISlave SPINUCLEO(PA_7,PA_6,PA_5,PA_4); +DigitalOut myled(LED1); +int main() { + int a=0; + myled = 0; +SPINUCLEO.frequency(21000000); +SPINUCLEO.reply(0x00); + +while (1) +{ +if (SPINUCLEO.receive()) +{ +a=SPINUCLEO.read(); +SPINUCLEO.reply(a); + myled = 1; +wait(2); +myled = 0; +wait(2); +} + +} + +}