Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
- Committer:
- polytech01
- Date:
- 2012-02-27
- Revision:
- 0:cda27773d8b4
File content as of revision 0:cda27773d8b4:
#include "mbed.h"
SPISlave slave(p11,p12,p13,p14);
Serial pc(USBTX, USBRX);
int main() {
slave.format(8,0);
slave.frequency(1000000);
int v, res;
while(1) {
if(slave.receive()) {
v = slave.read(); // Read byte from master
if(v!=0){// discard the dummy buffer write
pc.printf("v=%d\n\r", v);
res=(v+5); // Add 5 to it
slave.reply(res); // Make this the next reply
pc.printf("v++=%d\n\r", res);
}
}
}
}