Showing the length of mbed datatypes in bytes.

Dependencies:   mbed OptrexLCD

Revision:
0:124a3cf10d74
Child:
1:275d27c2d033
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Nov 29 23:14:17 2010 +0000
@@ -0,0 +1,40 @@
+/*************************************************************************
+* Gets the length of mbeds datatypes and display those on a 20x4 Optrex LCD
+* This LCD needs a different timing than a normal LCD, see the 
+* OptrexLCD program for more information. 
+**************************************************************************/
+
+#include "mbed.h"
+#include "OptrexLCD.h"
+
+DigitalOut BlinkLed(LED4);
+
+TextLCD lcd(p10, p12, p15, p16, p17, p18, TextLCD::LCD20x4 ); // rs, e, d0-d3
+
+void WaitRefres() // procedure for showing the result for 3 seconds before getting the next datatypes 
+{
+    wait(3);
+    lcd.cls();
+    BlinkLed = !BlinkLed;
+}    
+    
+int main() 
+{
+    BlinkLed = 1;   // show the program is running
+    while(1)
+    {    
+        lcd.printf("sizeof(char)  == %d\n", sizeof(char));
+        lcd.printf("sizeof(short) == %d\n", sizeof(short));
+        lcd.printf("sizeof(int)   == %d\n", sizeof(int));
+        lcd.printf("sizeof(long)  == %d\n", sizeof(long));
+        WaitRefres();
+        
+        lcd.printf("sizeof(float)  == %d\n", sizeof(float));
+        lcd.printf("sizeof(double) == %d\n", sizeof(double));
+        WaitRefres();
+        
+        lcd.printf("sizeof(long double)\n == %d\n", sizeof(long double));
+        lcd.printf("sizeof(long long)\n == %d\n", sizeof(long long));
+        WaitRefres();
+    } 
+}