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
00001 #include "mbed.h" 00002 00003 SPISlave slave(p11,p12,p13,p14); 00004 00005 Serial pc(USBTX, USBRX); 00006 00007 int main() { 00008 00009 slave.format(8,0); 00010 slave.frequency(1000000); 00011 int v, res; 00012 00013 00014 while(1) { 00015 00016 if(slave.receive()) { 00017 00018 v = slave.read(); // Read byte from master 00019 if(v!=0){// discard the dummy buffer write 00020 pc.printf("v=%d\n\r", v); 00021 res=(v+5); // Add 5 to it 00022 slave.reply(res); // Make this the next reply 00023 pc.printf("v++=%d\n\r", res); 00024 } 00025 00026 } 00027 } 00028 00029 00030 00031 }
Generated on Wed Aug 31 2022 06:42:06 by
1.7.2