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.
Dependencies: mbed
main.cpp
- Committer:
- Keith_N
- Date:
- 2018-11-19
- Revision:
- 0:286baeef532e
File content as of revision 0:286baeef532e:
#include "mbed.h" SPISlave device(PB_5,PB_4,PB_3,PA_4); // mosi, miso, sclk, ssel Serial pc(SERIAL_TX, SERIAL_RX); int main() { device.format(8,0); device.frequency(1000000); uint8_t hbyte = 7; uint8_t lbyte = 208; int counter = 0; while(1) { if(device.receive()) { int val = device.read(); pc.printf("received1: %d, ",val); device.reply(0xFF); int val2 = device.read(); pc.printf("received2: %d, ",val2); device.reply(hbyte); // Make this the next reply int val3 = device.read(); pc.printf("receive3: %d, ",val3); pc.printf("count: %d\r\n",counter); device.reply(lbyte); // Make this the next reply counter = counter+1; } wait(0.01); } }