Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of myOSC_test by
Revision 2:44f1e5803762, committed 2013-08-06
- Comitter:
- sfjmt
- Date:
- Tue Aug 06 10:12:56 2013 +0000
- Parent:
- 1:818cf7a97804
- Commit message:
- revision_01
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 818cf7a97804 -r 44f1e5803762 main.cpp
--- a/main.cpp Tue Aug 06 10:01:08 2013 +0000
+++ b/main.cpp Tue Aug 06 10:12:56 2013 +0000
@@ -6,29 +6,26 @@
EthernetNetIf eth;
#else
EthernetNetIf eth(
- IpAddr(192,168,12,210),//your mbed IP Address Set
- IpAddr(255,255,255,0),//Network Mask Set
+ IpAddr(192,168,12,210),//your mbed IP Address
+ IpAddr(255,255,255,0),//Network Mask
IpAddr(),//Gateway
IpAddr()//DNS
);
#endif
-//baud rate
-int BAUD_RATE = 115200;
-
-//uint8_t serverMac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
-
//receive
-uint8_t receiveIp[] = { 192, 168, 12, 210 };
-int receivePort = 5678;
+uint8_t receiveIp[] = { 192, 168, 12, 210 };//IP Address
+int receivePort = 5678;//port
//destination.
-uint8_t destIp[] = { 192, 168, 12, 51};
-int destPort = 10000;
+uint8_t destIp[] = { 192, 168, 12, 51};//IP Address
+int destPort = 10000;//port
//send value propaty.
char *topAddress = "/mbed";
char *subAddress[3] = {"/test1","/test2","/test3"};
+
+//receive value propaty
char *requestTopStr[3] = {"mbed1","mbed2","mbed3"};
char *requestSubStr[3] = {"test1","test2","test3"};
@@ -46,26 +43,20 @@
int main()
{
-
- // make debug port:
- pc.baud(BAUD_RATE);
-
// Set the Ethernet port:
-// printf("Setting up...\r\n");
EthernetErr ethErr = eth.setup();
if(ethErr) {
-// printf("Error %d in setup.\r\n", ethErr);
+ //error
return -1;
}
-// printf("Setup OK\r\n");
- //(1) Sending message >>>>>
+ //(1) Sending message >>>
// Set IP and Port:
sendMes.setIp( destIp );
sendMes.setPort( destPort );
- //(2) Receiving <<<<<
+ //(2) Receiving <<<
recMes.setIp(receiveIp);
osc.setReceiveMessage(&recMes); // this sets the receiver container for the OSC packets (we can avoid doing this if we use osc.getMessage() to get messages)
osc.begin(receivePort, &processOSC); // binds the upd (osc) messages to an arbitrary listening port ("server" port), and callback function
@@ -90,8 +81,7 @@
osc.onUDPSocketEvent(e);
if (osc.newMessage) {
- //pc.printf("we received top address %s\n", recMes.getAddress(0) );
-
+
osc.newMessage = false; // note: if using: message = osc.getMessage(), then we don't need to do this explicitly.
//(strcmp(str1,str2)==0)
@@ -115,20 +105,5 @@
//action
led = 0;//led LOW
}
-
- // Test:
-// if( !strcmp( recMes.getAddress(0) , "mbed" ) )
-// {
-// pc.printf("we received topAddress= mbed \n");
-//
-// if( !strcmp( recMes.getAddress(1) , "test1" ) )
-// {
-// pc.printf("we received subAddress= test1 \n");
-//
-// // Send some osc message:
-// sendMes.setTopAddress("/working...");
-// osc.sendOsc(&sendMes);
-// }
-// }
}
}
\ No newline at end of file
