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:
- OJ_2k
- Date:
- 2019-11-20
- Revision:
- 0:55a8e24bdaf9
File content as of revision 0:55a8e24bdaf9:
#include "mbed.h"
#include <SPISlave.h>
SPISlave device(D11, D12, D13, D8);
int main() {
device.reply(0x00); // Prime SPI with first reply
while(1) {
if(device.receive()) {
int v = device.read(); // Read byte from master
v = (v + 1) % 0x100; // Add one to it, modulo 256
device.reply(v); // Make this the next reply
}
}
}