ソースの整理中ですが、利用はできます。
Dependencies: EthernetInterface HttpServer TextLCD mbed-rpc mbed-rtos mbed Socket lwip-eth lwip-sys lwip
Diff: main.cpp
- Revision:
- 0:7766f6712673
diff -r 000000000000 -r 7766f6712673 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Mar 12 04:19:54 2014 +0000 @@ -0,0 +1,64 @@ +//#define DNS_SERVER_ADDRESS(ipaddr) (ip4_addr_set_u32(ipaddr, ipaddr_addr("208.67.222.222"))) /* resolver1.opendns.com */ +#include "mbed.h" +#include "rtos.h" +#include "EthernetInterface.h" +#include "HTTPServer.h" +#include "mbed_rpc.h" +#include "TextLCD.h" + +EthernetInterface eth; +LocalFileSystem local("local"); +DigitalOut led4(LED4); +//DigitalOut led1(LED1); +TextLCD lcd(p24, p26, p27, p28, p29, p30); + +void LcdWrite(Arguments* arg, Reply* r);void LcdWrite(Arguments* arg, Reply* r); +void aliveState(void const *args) +{ + while (true) { + led4 = !led4; + Thread::wait(1000); + } +} +int main() +{ + printf("********* PROGRAM START ***********\r\n"); + Thread thread(aliveState); + lcd.cls(); + lcd.locate(0,0); + + printf("********* RPC Initialize ***********\r\n"); + RPC::add_rpc_class<RpcDigitalOut>(); + RPC::construct<RpcDigitalOut, PinName, const char*>(LED1, "led1"); + RPC::construct<RpcDigitalOut, PinName, const char*>(LED2, "led2"); + RPC::construct<RpcDigitalOut, PinName, const char*>(LED3, "led3"); + RPCFunction rpcFunc(LcdWrite, "LcdWrite"); + + printf("EthernetInterface Setting up...\r\n"); + if(eth.init()!=0) { //for DHCP Server + // if(eth.init("133.11.168.23","255.255.255.0","133.11.168.1")!=0) { //for Static IP Address + printf("EthernetInterface Initialize Error \r\n"); + return -1; + } + if(eth.connect()!=0) { + printf("EthernetInterface Connect Error \r\n"); + return -1; + } + printf("IP Address is %s\r\n", eth.getIPAddress()); + printf("NetMask is %s\r\n", eth.getNetworkMask()); + printf("Gateway Address is %s\r\n", eth.getGateway()); + printf("Ethernet Setup OK\r\n"); + + FSHandler::mount("/local","/"); + + lcd.locate(0,0); + lcd.printf("%s",eth.getIPAddress()); + HTTPServerStart(80); +} + +void LcdWrite(Arguments* arg, Reply* r) //RPC Call +{ + lcd.locate(0,1); + lcd.printf("%s",arg->argv[0]); +} +