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:
- fvbever
- Date:
- 2015-02-25
- Revision:
- 0:f7540c6ff050
File content as of revision 0:f7540c6ff050:
#include "mbed.h"
Serial pc(USBTX, USBRX);
SPI spi(D11, D12, D13); // mosi, miso, sclk
DigitalOut cs(D10);
int main(){
pc.printf("SPI example application\r\n");
// chip must be deselected
cs=1;
// set up SPI
spi.format(8,0);
spi.frequency(1000000);
// select device
cs=0;
spi.write(0x80);
int id = spi.write(0x00);
printf("Device ID is= 0x%X\r\n",id);
// deselect device
cs = 1;
}