test publish read ethernet packets from second mbed and display to onboard lcd

Dependencies:   C12832 mbed

Files at this revision

API Documentation at this revision

Comitter:
vk5653
Date:
Wed Feb 18 21:32:24 2015 +0000
Commit message:
test commit 1; ; 2/18/15

Changed in this revision

C12832.lib Show annotated file Show diff for this revision Revisions of this file
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/C12832.lib	Wed Feb 18 21:32:24 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/chris/code/C12832/#7de323fa46fe
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Feb 18 21:32:24 2015 +0000
@@ -0,0 +1,28 @@
+/* Program Example 12.8: Ethernet read with display to onboard lcd
+                                                                          */
+#include "mbed.h"
+#include "C12832.h"
+
+C12832 lcd(p5, p7, p6, p8, p11);
+
+Ethernet eth;                          // Ethernet object
+
+char buf[0xFF];                        // create a large buffer to store data 
+int main() {
+  lcd.locate(0,0);
+  lcd.printf("Ethernet data read and display\n\r");
+  while (1) {
+    int size = eth.receive();              // get size of incoming data packet
+    if (size > 0) {                        // if packet received
+      eth.read(buf, size);                 // read packet to data buffer
+      lcd.locate(10,0);
+      lcd.printf("size = %d data = ",size); // print to screen
+      for (int i=0;i<size;i++) {           // loop for each data byte
+        lcd.locate(20,0);
+        lcd.printf("%02X ",buf[i]);         // print data to screen
+        wait(0.33);
+      }
+      // pc.printf("\n\r");
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Feb 18 21:32:24 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9ad691361fac
\ No newline at end of file