Jump to content

Recommended Posts

Geschrieben

I just added support for multiple graphs in one graph view and implemented it for the Temperature IR Bricklet. I will take a look at the setMode function tomorrow.

 

Edit: I don't like the distance between the two temperature <h3>'s in the new temp ir plugin and the text below the graph is a bit to close. But the good thing is that we can easily beautify the HTML later on, it will then automatically work for all graphs in the plugins ;).

  • Replies 61
  • Created
  • Letzte Antwort

Top Posters In This Topic

Geschrieben

It works for me. I just used one of our standard examples and called the setMode function:

 

<!DOCTYPE html>
<html>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <head>
        <title>Tinkerforge | JavaScript Example</title>
    </head>
    <body>
        <div style="text-align:center;">
            <h1>Analog Out Bricklet Simple Example</h1>
            <p>
                <input value="localhost" id="host" type="text" size="20">:
                <input value="4280" id="port" type="text" size="5">,
                <input value="uid" id="uid" type="text" size="5">
                <input value="Start Example" id="start" type="button" onclick="startExample();">
            </p>
            <p>
                <textarea id="text" cols="80" rows="24" style="resize:none;"
                          >Press "Start Example" to begin ...</textarea>
            </p>
        <div>
        <script src="./Tinkerforge.js" type='text/javascript'></script>
        <script type='text/javascript'>
            var ipcon;
            var textArea = document.getElementById("text");
            function startExample() {
                textArea.value = "";
                var HOST = document.getElementById("host").value;
                var PORT = parseInt(document.getElementById("port").value);
                var UID = document.getElementById("uid").value;
                if(ipcon !== undefined) {
                    ipcon.disconnect();
                }
                ipcon = new Tinkerforge.IPConnection(); // Create IP connection
                var ao = new Tinkerforge.BrickletAnalogOut(UID, ipcon); // Create device object
                ipcon.connect(HOST, PORT,
                    function(error) {
                        textArea.value += 'Error: '+error+ '\n';
                    }
                ); // Connect to brickd
                // Don't use device before ipcon is connected

                ipcon.on(Tinkerforge.IPConnection.CALLBACK_CONNECTED,
                    function(connectReason) {
                        ao.setMode(Tinkerforge.BrickletAnalogOut.MODE_1K_TO_GROUND);
                    }
                );
            }
        </script>
    </body>
</html>

  • 2 weeks later...
Geschrieben

Hey guys!

 

I have just downloaded the JS API (I assume it is fresh from the oven, I didn't see it yesterday) and was trying the browser implementation but no go. I cannot seem to connect the device at all, I am always getting error 13. Basically I just copied over the browser implementation JS file and put it to the html files, does it need anything else? I am not using node.js and I haven't tested that version.

 

Your feedback is much appreciated! Thanks.

Geschrieben

Did you already try the examples? Which version of brickD do you use? You need the latest update of brickD which was released to today to use the examples.

Geschrieben

brickd, brickv - both version 2.1.0.

 

Using Brick IMU 1.2. The device appears alright in the viewer. The JS examples don't work, code 13 all the time.

 

Test on OS X 10.9.2 with the latest FF and Chrome.

Geschrieben

@Fygo: We currently still in the process of releasing the JavaScript Bindings, so you are very early ;D.

 

By default the websockets are disabled in the brickd, but the documentation on how to enable it is not yet online :). Give me a few more minutes, then i can give you a link.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Reply to this topic...

×   Du hast formatierten Text eingefügt.   Formatierung jetzt entfernen

  Only 75 emoji are allowed.

×   Dein Link wurde automatisch eingebettet.   Einbetten rückgängig machen und als Link darstellen

×   Dein vorheriger Inhalt wurde wiederhergestellt.   Clear editor

×   Du kannst Bilder nicht direkt einfügen. Lade Bilder hoch oder lade sie von einer URL.


×
×
  • Neu erstellen...