-
1Step 1
Connect devices to obniz as below and place it in your house.
-
2Step 2
Write programs written below. Change obniz id in the example. By clicking "Save&Open", You can see a temperature.
-
3Step 3
Record a your air conditioner signal for ON/OFF.
The example contains comment outed code for IR receiver. Remove the comment out and record your air conditioner's ON/OFF signal. Your signal will be showed in log.
Put it recorded data array into your program.
-
4Use it !
Just open the HTML, You can control your air conditioner from everywhere in the world!
-
5Program
<!-- HTML Example --> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css"> <script src="https://obniz.io/js/jquery-3.2.1.min.js"></script> <script src="https://unpkg.com/obniz@1.6.1/obniz.js"></script> </head> <body> <div id="obniz-debug"></div> <h1 id="temp">Measuring...</h1> <p> <button id="on" class="btn btn-primary btn-block">Turn ON</button> </p> <p> <button id="off" class="btn btn-primary btn-block">Turn OFF</button> </p> <script> var obniz = new Obniz("OBNIZ_ID_HERE"); obniz.onconnect = async function () { //var sensor = obniz.wired('IRSensor', {vcc:0, gnd:3, output: 2}); //sensor.start(function (arr) { // console.log('detected!!') // console.log(JSON.stringify(arr)); //}) // Javascript Example var tempsens = obniz.wired("LM35DZ", { gnd:7 , output:8, vcc:9}); tempsens.onchange = function(temp){ $("#temp").text('' + parseInt(temp)+ ' degree') obniz.display.clear(); obniz.display.font('Avenir', 60) obniz.display.print('' + parseInt(temp) + '℃') }; var infraredLed = obniz.wired('InfraredLED', {anode: 1, cathode: 3}); $("#on").click(function(){ // your value for ON here. infraredLed.send([]) }) $("#off").click(function(){ // your value for OFF here infraredLed.send([]) }) } </script> </body> </html>
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.