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.
Diff: main.cpp
- Revision:
- 0:cda27773d8b4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Mon Feb 27 16:30:35 2012 +0000
@@ -0,0 +1,31 @@
+#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);
+ }
+
+ }
+ }
+
+
+
+}