proccessing on iPad, iPhone access to server

Home Forums Procoding proccessing on iPad, iPhone access to server

This topic contains 4 replies, has 1 voice, and was last updated by  JB 5 years, 2 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #962

    JB

    Hi
    I am new to Procoding. I know Processing well because I am used to the Arduino platform.
    I would like to program a sketch in processing. I already figured out that import of libraries does not work.
    I want to open a TCP connection to a server. I would like to use Telnet or HTTP. The data on the server will
    be a text file when HTTP is used or a line ended by a newline character. Maybe I can just have a few lines of example code
    doing a Telnet or HTTP connection and read and write a few bytes or lines.

    Thanks in advance
    JB

    #963

    audiocommander
    Keymaster

    Hi JB,

    TCP is an issue, you’ll need a Library for that and this will be incompatible to Processing.js (and Procoding), unless you add a shim that’s using WebSockets or something…

    Otherwise, I think you are looking for loadStrings: https://www.processing.org/reference/loadStrings_.html
    Also see this nice tutorial how to save a string with loadStrings: http://www.learningprocessing.com/tutorials/php/

    Hope this helps,
    Michael

    PS: even though Arduino and Processing share the same Interface, Arduino uses C (and C++) while Processing is running JAVA. So beware of the thought that it’s the same. It’s two different programming languages. And btw, JavaScript has nothing to do with JAVA as well.

    #969

    JB

    Hi Michael,

    that helps a lot. The loadStrings is fine to get data from the Arduino Yun. That will be enough for my current project.
    But I am curious: How can I get data back to my Arduino Yun? I could write a sketch to receive data, but what can I use with Procoding to get that to the Yun? I need something heading in the opposite direction similar to loadStrings? saveStrings seems to work just on files.

    Best Regards
    JB

    #970

    audiocommander
    Keymaster

    Hi JB,

    loadStrings also works with URLs.

    Have you seen the second link? If you’re calling a webpage with loadStrings, you can also attach arguments in a GET manner, like: loadStrings(“http://myarduino.local/script?param=hello%20Im%20a%20String”);
    http://www.learningprocessing.com/tutorials/php/

    I’ve worked with a Yún where we installed node.js and I’m communicating with a WebSocket port. That’s super fast and quite reliable, that would be similar to a TCP connection. However, node.js already consumes most of the internal memory.

    The simplest solution would probably be to add a script as webpage on the Yún. I don’t know if it’s necessary to install PHP on the Yún, haven’t worked on that part. Maybe it’s sufficient to just put a Lua script in some directory. (There’s also a WebSocket Library for Lua, btw, but don’t forget that Processing.js can’t do WebSockets, that would be JavaScript only or a mixin).

    Best,
    Michael

    Btw: Procoding on Mac OS X has node.js support: if it’s installed on your system you can run JS based script with node…

    #979

    JB

    Hi Michael,
    I think I will give PHP a try. It will be necessary for me to work with server based scripts. So PHP is fine.
    Maybe OT here but if you are short with disk-space on the root fs on a Yun try this link:
    http://arduino.cc/en/Tutorial/ExpandingYunDiskSpace that will expand and move your root fs on an inserted Micro SD card.

    Thanks for your help
    Josef

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘proccessing on iPad, iPhone access to server’ is closed to new replies.