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:b3c424b6a516
diff -r 000000000000 -r b3c424b6a516 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Tue Nov 01 05:08:20 2022 +0000
@@ -0,0 +1,24 @@
+#include "mbed.h"
+Serial pc(USBTX, USBRX);
+DigitalOut myled(LED1);
+SPI spi(p11, p12, p13); //mosi, miso, sclk
+DigitalOut cs(p14);
+#define DTIME 0.005
+
+int main() {
+ spi.format(8,0);
+ spi.frequency(1000000);
+ int teste;
+ teste=0xAA;
+ while(1){
+ cs=0;
+ wait(DTIME);
+ int result = spi.write(teste);
+ pc.printf("Send to Slave = %d\n\r", teste);
+ pc.printf("Reply from Slave = %d\n\r", result);
+ pc.printf("\n\r");
+ wait(DTIME);
+ cs=1;
+ wait(1);
+ }
+}