Shop OBEX P1 Docs P2 Docs Learn Events
Can PINK run Java Script — Parallax Forums

Can PINK run Java Script

NWCCTVNWCCTV Posts: 3,629
edited 2013-04-27 08:07 in General Discussion
I got my PINK working and am able to upload web pages to it. My next issue/question is can a PINK run Java script? I want to be able to control my Prop this way. Which, in turn, leads to my next question for all you Java gurus. I am familiar with html programming but have never coded in Java. What is a good quick and easy way to get up and running? Basically I just want to create a web page that has a menu with buttons that will control features on my Prop that are connected through the PINK.

Edit: If there is an easier way to accomplish this by all means let me know.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2013-04-25 19:50
    No. The PINK cannot run Javascript. That's a browser function. The PINK just serves up the webpage source which may include Javascript pieces.

    The way this works is that the Propeller talks over the serial connection to the PINK. The various PINK commands allow the Prop to read and set a bunch of string variables in the PINK that can be incorporated into the HTML being served up. In the HTML, you can set up a menu that causes specific values to be placed into these string variables which the Prop can read. Similarly, you can set up buttons which, when clicked, change a value in one of these string variables. Essentially, the HTML causes the browser to send a message over the Internet to the PINK and the PINK changes a specified string variable to a value that's also sent.
  • NWCCTVNWCCTV Posts: 3,629
    edited 2013-04-25 20:10
    OK, So if my web page has the Java script on it could I accomplish what I am trying to do?

    Edit: I would appreciate it if anyone can point me in the right direction. Just to get started if I can click on a button on a web page that is loaded on the PINK and have it turn on an LED that will get me closer to my goal and I should be able to figure it out after that.
  • kwinnkwinn Posts: 8,697
    edited 2013-04-25 21:05
    "OK, So if my web page has the Java script on it could I accomplish what I am trying to do?"

    Yes. You have the Pink web page java script create a button that toggles between on/off. When the browser reads that java script it creates the button. When you click on the button the browser sends information back to the Pink. The pink uses that information to set a variable that your prop can read, and you can use that variable to control the led.
  • NWCCTVNWCCTV Posts: 3,629
    edited 2013-04-25 21:12
    Do you by chance have an example? I have been reading the PINK documents but I am getting confused.
  • kwinnkwinn Posts: 8,697
    edited 2013-04-26 19:02
    NWCCTV wrote: »
    Do you by chance have an example? I have been reading the PINK documents but I am getting confused.

    Sorry, I don't have an example. That was a project I worked on before I became a prop convert. It was done with a different microprocessor and an 80386 based SBC in place of the Pink. Perhaps Phil or Bits could help. IIRC they posted info on something similar a while back.
  • skylightskylight Posts: 1,915
    edited 2013-04-27 08:07
    http://www.parallax.com/dl/docs/prod/comm/30013-PINK-v1.02.pdf

    s
    hows you how to write and read the variables for a basic stamp,you could use the OBEX object that uses basic stamp commands on the prop or convert the examples yourself to the prop.
Sign In or Register to comment.