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:f7540c6ff050
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Feb 25 08:05:24 2015 +0000
@@ -0,0 +1,31 @@
+#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;
+}
+
+
+
+
\ No newline at end of file