test

Dependencies:   mbed MMA8452Q

Fork of HelloWorld by Simon Ford

Revision:
28:f56de0b0764e
Parent:
27:0f602aca65f1
Child:
29:3acc071af432
diff -r 0f602aca65f1 -r f56de0b0764e main.cpp
--- a/main.cpp	Fri Sep 08 04:13:54 2017 +0000
+++ b/main.cpp	Fri Sep 08 05:50:44 2017 +0000
@@ -299,4 +299,80 @@
         wait(0.2);
     }
 }
-*/
\ No newline at end of file
+*/
+
+// I2C write
+/*
+I2C    i2c( p28, p26 );        // sda, scl
+ 
+int main() {
+    char    data[3];
+ 
+    data[0]   = 0x16;
+    data[1]   = 0x55;
+    data[2]   = 0x55;
+ 
+    i2c.write( 0xC0, data, 3 ); //0xC0 is slave adress 
+}*/
+
+// I2C Read
+/*
+short read_sensor_lower_8bit( void )
+{
+    char    v;
+    char    cmd;
+ 
+    cmd    = 0x05;
+ 
+    i2c.write( 0x88, &cmd, 1 );
+    i2c.read( 0x88, &v, 1 );
+ 
+    return( v );
+}
+*/
+
+/*
+int main() {
+    set_time(1256729737);  // Set RTC time to Wed, 28 Oct 2009 11:35:37
+}*/
+
+/*
+int main() {
+    while(1) {
+        time_t seconds = time(NULL);
+
+        printf("Time as seconds since January 1, 1970 = %d\n", seconds);
+
+        printf("Time as a basic string = %s", ctime(&seconds));
+
+        char buffer[32];
+        strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds));
+        printf("Time as a custom formatted string = %s", buffer);
+
+        wait(1);
+    }
+}*/
+/*
+int main() {
+
+    // get the current time from the terminal
+    struct tm t;
+    printf("Enter current date and time:\n");
+    printf("YYYY MM DD HH MM SS[enter]\n");    
+    scanf("%d %d %d %d %d %d", &t.tm_year, &t.tm_mon, &t.tm_mday
+                             , &t.tm_hour, &t.tm_min, &t.tm_sec);
+
+    // adjust for tm structure required values
+    t.tm_year = t.tm_year - 1900;
+    t.tm_mon = t.tm_mon - 1;
+    
+    // set the time
+    set_time(mktime(&t));
+        
+    // display the time
+    while(1) {    
+        time_t seconds = time(NULL);
+        printf("Time as a basic string = %s", ctime(&seconds));
+        wait(1);
+    }
+}*/
\ No newline at end of file