Iniversity work

Dependencies:   mbed MMA8452

Files at this revision

API Documentation at this revision

Comitter:
vinceP
Date:
Wed Aug 30 13:28:26 2017 +0000
Child:
1:0630912bb400
Commit message:
initial comit

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	Wed Aug 30 13:28:26 2017 +0000
@@ -0,0 +1,54 @@
+#include "mbed.h"
+
+DigitalOut myled(LED1);
+Serial pc(USBTX, USBRX);
+//Serial uart(p13,p14);
+SPI spiTest(p5, p6, p7);
+DigitalOut cs(p8);
+
+int main() {
+    //I2C
+    while(1) {
+
+    }
+}
+
+/*
+int main() {
+    //https://developer.mbed.org/handbook/SerialPC
+    //https://developer.mbed.org/handbook/mbed-NXP-LPC1768-Getting-Started
+    //pc.printf("Echoes back to the screen anything you type\n");
+    int nombre = 2;
+    cs = 1;
+    //uart.printf("%d",nombre);
+    // Setup the spi for 8 bit data, high steady state clock,
+    // second edge capture, with a 1MHz clock rate
+    // spiTest.format(8,3);
+    // spiTest.frequency(1000000);
+    cs = 0;
+ 
+    // Send 0x8f, the command to read the WHOAMI register
+    int t =  spiTest.write(0x8F);
+    pc.printf("WHOAMI register = %X\r\n", t);
+ 
+    // Send a dummy byte to receive the contents of the WHOAMI register
+    //int whoami = spiTest.write(0x00);
+    //printf("WHOAMI register = 0x%X\n", whoami);
+    cs = 1;
+    while(1) {
+        //uart.printf("%c",pc.getc());
+        cs = 0;
+ 
+        // Send 0x8f, the command to read the WHOAMI register
+        pc.scanf("%d",&nombre);
+        t = spiTest.write(nombre);
+        pc.printf("WHOAMI register = %X\r\n", t);
+        cs = 0;
+        myled = 1;
+        wait(0.2);
+        myled = 0;
+        wait(0.2);
+        //pc.putc(pc.getc());
+    }
+}
+*/
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Aug 30 13:28:26 2017 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/mbed_official/code/mbed/builds/e2bfab296f20
\ No newline at end of file