a
Revision 0:b3c424b6a516, committed 24 months ago
- Comitter:
- goro56
- Date:
- Tue Nov 01 05:08:20 2022 +0000
- Commit message:
- a
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /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);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Nov 01 05:08:20 2022 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file