This demo program flashes "Tiffany Yep" in binary on the LEDs and sends "Tiffany Yep makes the net work!" on the serial console and Ethernet port. (Tiffany Yep, a digital communications engineer/model, is my best friend.)

Dependencies:   mbed NetServicesSource

Files at this revision

API Documentation at this revision

Comitter:
NiHaoMike
Date:
Fri Oct 22 21:41:07 2010 +0000
Commit message:

Changed in this revision

NetServicesSource.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
diff -r 000000000000 -r 4d5731f3230c NetServicesSource.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/NetServicesSource.lib	Fri Oct 22 21:41:07 2010 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/donatien/code/NetServicesSource/#da4498f591ee
diff -r 000000000000 -r 4d5731f3230c main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Oct 22 21:41:07 2010 +0000
@@ -0,0 +1,80 @@
+#include "mbed.h"
+#include "EthernetNetIf.h"
+#include "UDPSocket.h"
+PwmOut led1(LED1);
+PwmOut led2(LED2);
+PwmOut led3(LED3);
+PwmOut led4(LED4);
+EthernetNetIf eth(IpAddr(192,168,0,50),IpAddr(255,255,255,0),NULL,NULL);
+UDPSocket udp;
+Serial pc(USBTX, USBRX);
+void PWM(char in) {
+    wait(0.2);
+    if(in&0x80)
+        led1.write(1);
+    else
+        led1.write(0.01);
+    if(in&0x40)
+        led2.write(1);
+    else
+        led2.write(0.01);
+    if(in&0x20)
+        led3.write(1);
+    else
+        led3.write(0.01);
+    if(in&0x10)
+        led4.write(1);
+    else
+        led4.write(0.01);
+    wait(0.2);
+    led1.write(0);
+    led2.write(0);
+    led3.write(0);
+    led4.write(0);
+    wait(0.1);
+    if(in&0x08)
+        led1.write(1);
+    else
+        led1.write(0.01);
+    if(in&0x04)
+        led2.write(1);
+    else
+        led2.write(0.01);
+    if(in&0x02)
+        led3.write(1);
+    else
+        led3.write(0.01);
+    if(in&0x01)
+        led4.write(1);
+    else
+        led4.write(0.01);
+    wait(0.2);
+    led1.write(0);
+    led2.write(0);
+    led3.write(0);
+    led4.write(0);
+}
+int main() {
+    eth.setup();
+    pc.baud(115200);
+    led1.period_ms(1);
+    Host bcast(IpAddr(255,255,255,255),1337,NULL);
+    udp.bind(bcast);
+    const char* str="Tiffany Yep makes the net work!\n\r";
+    while(1) {
+        pc.printf(str);
+        wait(0.5);
+        PWM('T');
+        PWM('i');
+        PWM('f');
+        PWM('f');
+        PWM('a');
+        PWM('n');
+        PWM('y');
+        udp.sendto(str,strlen(str),&bcast);
+        PWM('Y');
+        PWM('e');
+        PWM('p');
+        
+    }
+}
diff -r 000000000000 -r 4d5731f3230c mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Oct 22 21:41:07 2010 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e