http://mbed.org/users/okini3939/notebook/logger/

Dependencies:   mbed

Committer:
okini3939
Date:
Sat Apr 16 15:15:48 2011 +0000
Revision:
0:a3c892f39cc1

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
okini3939 0:a3c892f39cc1 1 #include "mbed.h"
okini3939 0:a3c892f39cc1 2 #include "EthernetNetIf.h"
okini3939 0:a3c892f39cc1 3 #include "logger.h"
okini3939 0:a3c892f39cc1 4
okini3939 0:a3c892f39cc1 5 DigitalOut myled(LED1);
okini3939 0:a3c892f39cc1 6 EthernetNetIf eth;
okini3939 0:a3c892f39cc1 7 logger *syslog;
okini3939 0:a3c892f39cc1 8
okini3939 0:a3c892f39cc1 9 int main() {
okini3939 0:a3c892f39cc1 10 EthernetErr r;
okini3939 0:a3c892f39cc1 11 int i;
okini3939 0:a3c892f39cc1 12 char buf[100];
okini3939 0:a3c892f39cc1 13
okini3939 0:a3c892f39cc1 14 r = eth.setup();
okini3939 0:a3c892f39cc1 15 if (r) {
okini3939 0:a3c892f39cc1 16 printf("Error %d in setup.\n", r);
okini3939 0:a3c892f39cc1 17 return -1;
okini3939 0:a3c892f39cc1 18 }
okini3939 0:a3c892f39cc1 19
okini3939 0:a3c892f39cc1 20 syslog = new logger(&eth, "192.168.1.8", "mbed");
okini3939 0:a3c892f39cc1 21
okini3939 0:a3c892f39cc1 22 i = 0;
okini3939 0:a3c892f39cc1 23 while(1) {
okini3939 0:a3c892f39cc1 24 Net::poll();
okini3939 0:a3c892f39cc1 25 sprintf(buf, "message %d", i++);
okini3939 0:a3c892f39cc1 26 syslog->send("test:", buf);
okini3939 0:a3c892f39cc1 27 wait(5);
okini3939 0:a3c892f39cc1 28 }
okini3939 0:a3c892f39cc1 29 }