Motor Control board Slave control
Dependencies: mbed
main.cpp
- Committer:
- rvasquez6089
- Date:
- 2017-03-29
- Revision:
- 0:673453dbcc7a
File content as of revision 0:673453dbcc7a:
#include "mbed.h" //DigitalOut myled(LED1); SPISlave device(PB_5,PB_4, PB_3, PA_4); // mosi, miso, sclk, ssel Serial pc(SERIAL_TX, SERIAL_RX); int main() { pc.baud(115200); pc.printf("The F303K8 is working \n\r"); char v = 0; device.reply(0x00); // Prime SPI with first reply device.format(8,3); device.frequency(1000000); while(1) { //pc.printf("Slave is about to read"); if(device.receive()) { v = device.read(); // Read byte from master // Add one to it, modulo 256 pc.printf("Slave recieved byte %c \n\r",v); //device.reply(v); // Make this the next reply } } }