replacing processing.net code by netp5 code for android mode

edited May 2014 in Android Mode

I wrote a simple code in processing using processing.net library to send a data to my wishield to control it...however what i was trying to do was go to android mode and use it, I found that processing.net doesn't work in android mode so now i need to write a code using OSCP5 and netP5, i'm trying it whole day but not a single success in even turning on a led...my processing.net code is

import processing.net.*;
Client myClient; 
//int dataIn; 
String data;

void setup() { 
  size(200, 200); 
  myClient = new Client(this, "192.168.1.122", 1000);
} 

void draw() { 
  fill(255,0,0);
rect(50,50,100,100);
  if (myClient.available() > 0) { 
  //dataIn = myClient.read(); 
   data = myClient.readString();
  println(data);
  } 
  //background(dataIn); 
myClient.clear();
}
void mousePressed() {
  myClient.write("1\n");
  myClient.stop();
    myClient = new Client(this, "192.168.1.122", 1000);
}

all i want to do is send "1\n" to my device 192.168.1.122 at port 1000 using netP5 and Osc5, I'm new to these libraries and I've not been able to get any result despite trying to hack into tcp codes...please provide me with small code example to just send "1\n" to the needed ip address at required port...then maybe i can develop an android app

Answers

  • Release the caps lock key, there is no need to yell in the subject!

    I fixed that.

  • i wasn't yelling at all...it happened to be on while i was typing in a form...then i typed my question here..I never knew that cap lock meant yelling...sorry for that

  • Maybe I won't get help on writing a complete code mirror in netp5 and oscp5 because i know it's my research to do, but to be more precise how can i stop the client using oscp5 or netp5...i've ttried sending message in various formats using oscp5 and netp5 duo but maybe they were sent in udp format because they didn't work in hardware side, i just need to send "1\n" so if anyone could provide me a correct working syntax, it would be great help...I'm not i great hurry but my hands are completely full so I thought i could get little help from forum...I hope my request is not selfish...thanks in advance

  • edited May 2016

    Hi Nutan.

    This looks similar to the Server Client example Link... (https://processing.org/tutorials/network/)

    I did manage to get the second example to work over two windows PC. First try was over the local network...then with port forwarding of bother PC's I managed to get the example to work with my internet IP over the web (Remember to disable firewall).

    I'm also wanting to get this to work on Android. However I can not get the example to run on an Android device or in Android mode.

    Maybe later today I will post a detailed video running the processing.net library sketch...I encourage you to do the same...just block out your IP and ports.

Sign In or Register to comment.