关于EthernetShield的问题
2015-04-141.1万
AI 快速预览详细
本文解决了在使用EthernetShield进行UDP通信时,Processing中编译报错“No library found for hypermedia.net”的问题。通过将hypermedia.net库文件安装在'sketchbook'文件夹内的'libraries'文件夹中,可以解决该问题。这对于需要进行网络通信的Arduino项目非常有用。
|
最近买了一块EthernetShield盾板,然后直接参考例程UDPSendReceive.pde: 其中有一段与Processing互动的代码如下(在processing中编译): /* Processing sketch to run with this example ===================================================== */ // Processing UDP example to send and receive string data from Arduino // press any key to send the "Hello Arduino" message // import hypermedia.net.*; UDP udp; // define the UDP object void setup() { udp = new UDP( this, 6000 ); // create a new datagram connection on port 6000 //udp.log( true ); // <-- printout the connection activity udp.listen( true ); // and wait for incoming message } void draw() { } void keyPressed() { String ip = "192.168.1.177"; // the remote IP address int port = 8888; // the destination port udp.send("Hello World", ip, port ); // the message to send } void receive( byte[] data ) { // <-- default handler //void receive( byte[] data, String ip, int port ) { // <-- extended handler for(int i=0; i < data.length; i++) print(char(data)); println(); } 在processing中编译通不过,No library found for hypermedia.net Libraries must be installed in a folder named 'libraries' inside the 'sketchbook' folder. 哪位朋友知道hypermedia.net怎么获取啊? |



