test

Dependencies:   mbed

Fork of SPI_master_mdot by Erick

Files at this revision

API Documentation at this revision

Comitter:
jinu
Date:
Sat Oct 01 10:02:57 2016 +0000
Parent:
0:bd27ff0337e4
Commit message:
master slave code;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Jun 10 05:19:39 2016 +0000
+++ b/main.cpp	Sat Oct 01 10:02:57 2016 +0000
@@ -1,10 +1,15 @@
 #include "mbed.h"
- 
+
 SPI spimaster(SPI1_MOSI, SPI1_MISO, SPI1_SCK);
 DigitalOut cs(SPI1_CS);
- 
+Serial pc(USBTX,USBRX); 
 int main() 
 {
+    
+    pc.baud(115200);
+    pc.printf("TTN mDot LoRa Temperature sensor starting ... \r\n");
+    
+    printf("\r\nDummy print");
     int response;
     // Chip must be deselected
     cs = 1;
@@ -19,7 +24,15 @@
         cs = 0;
     
         // Send a dummy byte to receive response from the slave
-        response = spimaster.write(0x00);
+        response = spimaster.write(0x1);
+        response = spimaster.write(0x2);
+        response = spimaster.write(0x3);
+        response = spimaster.write(0x4);
+        response = spimaster.write(0x5);
+        response = spimaster.write(0x6);
+        response = spimaster.write(0x7);
+        response = spimaster.write(0x8);
+        
         printf("\r\nSlave response = 0x%X", response);
  
         // Deselect the device