Giter Club home page Giter Club logo

Comments (2)

nrobertus avatar nrobertus commented on July 22, 2024

Hey there, @happytm!

I'd be glad to help.

To answer your questions:

  • I believe so. I think you will need to make sure you are using both byte zero from the upper table as well as byte one from any of the lower tables to make sure it works, so as long as you provide two byte command codes, I think it should work.

  • As of right now, the Android app doesn't actually work. For some reason, I cannot get React Native to interact with the API, even when I'm connected to the NodeMCU wifi network. I'm guessing there's some security layer there that is messing with that, but I'm not totally sure yet. If it did work, however, it would need no modifications, as all the changes would be on the NodeMCU side. You would just need to replace the command codes with the Sony ones and then the app should function normally.

  • I would imagine it is. This blog post describes how to get .ino files running on your Pi

Let me know if there is anything I can do to help.

from blackmagic-lanc.

happytm avatar happytm commented on July 22, 2024

Hi ,

Thanks for your quick reply.I think it will be fair to give you some background of my project. Right now I am using following for my project :

Elmo PTC-100S Camera - https://www.bhphotovideo.com/c/product/250457-REG/Elmo_9718_2_PTC_100S_1_4_Inch_CCD_Color.html - this camera is very impressive for it's zoom.it uses Sony's Visca protocol but it was easy to control with built in IR receiver. I am using following code in python with LIRC to control it :

from flask import Flask, render_template, request
from os import curdir
import subprocess

app = Flask(name)

@app.route("/")
def main():
templateData = {}
return render_template('remote.html', **templateData)

@app.route('/send/')
def send_ir_command(button):
command = ['irsend','SEND_ONCE']
if button == "KEY_POWER" or button == "backlight" or button == "reset" or button == "irisopen" or button == "focusnear" or button == "preset" or button == "id" or button == "KEY_1" or button == "KEY_4" or button == "irisclose" or button == "focusfar" or button == "KEY_2" or button == "KEY_5" or
button == "irisauto" or button == "focusauto" or button == "KEY_3" or button == "KEY_6" or button == "tele" or button == "wide" or button == "KEY_MENU" or button == "KEY_UP" or button == "KEY_LEFT" or button == "KEY_RIGHT" or button == "KEY_DOWN" or button == "KEY_HOME" or button == "cursor" :

    command.append('Elmo_PRC-100S')
	
else:
    command.append('Sony')
command.append(button)
command = " ".join(command)
templateData = {'button':button}
subprocess.call(command, shell=True)
return "{} - OK".format(button)

if name == "main":
print(curdir)
app.run(host='0.0.0.0', port=8082, debug=True)

As you can see the code above serve remote.html page at localhost:8082 code for which is below :

<title>Pi Remote Control</title> <style> .btn { background: #3498db; background-image: -webkit-linear-gradient(top, #3498db, #2980b9); background-image: -moz-linear-gradient(top, #3498db, #2980b9); background-image: -ms-linear-gradient(top, #3498db, #2980b9); background-image: -o-linear-gradient(top, #3498db, #2980b9); background-image: linear-gradient(to bottom, #3498db, #2980b9); -webkit-border-radius: 28; -moz-border-radius: 28; border-radius: 28px; font-family: Arial; color: #ffffff; font-size: 10px; padding: 5px 10px 5px 10px; text-decoration: none; width: 50px; } .btn:hover { background: #3cb0fd; background-image: -webkit-linear-gradient(top, #3cb0fd, #3498db); background-image: -moz-linear-gradient(top, #3cb0fd, #3498db); background-image: -ms-linear-gradient(top, #3cb0fd, #3498db); background-image: -o-linear-gradient(top, #3cb0fd, #3498db); background-image: linear-gradient(to bottom, #3cb0fd, #3498db); text-decoration: none; } </style>
<script>
  var sendButton = function(buttonId) {
    var xhttp = new XMLHttpRequest();
    
    xhttp.onreadystatechange = function() {
        if (this.readyState == 4 && this.status == 200) {
            document.getElementById("console").innerHTML = this.responseText;
        }
    };
    var button = document.getElementById(buttonId);
    var urlCommand = window.location.href + "send/" + buttonId;
    //var buttonName = document.getElementById("button" + buttonId);
    button.style.opacity = 0.5;
    button.disabled = true;
    xhttp.open("GET", urlCommand, true);
    xhttp.send();
    setTimeout(function() { button.style.opacity = 1; button.disabled = false; }, 300);
    //document.getElementById('console').innerHTML += buttonId;
    //document.getElementById('console').innerHTML +=  window.location.href 
  }
</script>
Zoom↑ ↑ Zoom↓ 1 2 3

<button id="KEY_LEFT" class="btn" onclick="sendButton(this.id)">&larr;</button>
<button id="KEY_HOME" class="btn" onclick="sendButton(this.id)">Home&crarr;</button>
<button id="KEY_RIGHT" class="btn" onclick="sendButton(this.id)">&rarr;</button>
<button id="KEY_4" class="btn" onclick="sendButton(this.id)">4</button>
<button id="KEY_5" class="btn" onclick="sendButton(this.id)">5</button>
<button id="KEY_6" class="btn" onclick="sendButton(this.id)">6</button><br/>

<button id="KEY_MENU" class="btn" onclick="sendButton(this.id)">MENU&#x21B6;</button>
<button id="KEY_DOWN" class="btn" onclick="sendButton(this.id)">&darr;</button>
<button id="reset" class="btn" onclick="sendButton(this.id)">Reset</button>
<button id="KEY_POWER" class="btn" onclick="sendButton(this.id)"><i class="fa fa-power-off"></i></button>
<button id="KEY_RECORD" class="btn" onclick="sendButton(this.id)"><i style="color: red;" class="fa fa-circle"></i></button>
<button id="KEY_STOP" class="btn" onclick="sendButton(this.id)"><i class="fa fa-stop"></i></button><br/>

<button id="KEY_7" class="btn" onclick="sendButton(this.id)">7</button>
<button id="KEY_8" class="btn" onclick="sendButton(this.id)">8</button>
<button id="KEY_9" class="btn" onclick="sendButton(this.id)">9</button><br/>
<button id="KEY_INFO" class="btn" onclick="sendButton(this.id)"><i class="fa fa-info"></i></button>
<button id="KEY_0" class="btn" onclick="sendButton(this.id)">0</button>
<button id="KEY_PREVIOUS" class="btn" onclick="sendButton(this.id)">PRE</button><br/><br/>
 <button id="KEY_REWIND" class="btn" onclick="sendButton(this.id)"><i class="fa fa-backward"></i></button>
<button id="KEY_PAUSE" class="btn" onclick="sendButton(this.id)"><i class="fa fa-pause"></i></button>
<button id="KEY_FORWARD" class="btn" onclick="sendButton(this.id)"><i class="fa fa-forward"></i></button><br/>

<button id="KEY_PLAY" class="btn" onclick="sendButton(this.id)"><i class="fa fa-play"></i></button>


<button id="KEY_CYCLEWINDOWS" class="btn" onclick="sendButton(this.id)">Source</button><br/><br/>

<button id="KEY_VOLUMEUP" class="btn" onclick="sendButton(this.id)"><i class="fa fa-volume-up"></i></button>
<button id="KEY_MUTE" class="btn" onclick="sendButton(this.id)"><i class="fa fa-volume-off"></i></button>
<button id="KEY_CHANNELUP" class="btn" onclick="sendButton(this.id)"><i class="fa fa-toggle-up"></i></button><br/>
<button id="KEY_VOLUMEDOWN" class="btn" onclick="sendButton(this.id)"><i class="fa fa-volume-down"></i></button>
<button id="KEY_LIST" class="btn" onclick="sendButton(this.id)">LIST</button>
<button id="KEY_CHANNELDOWN" class="btn" onclick="sendButton(this.id)"><i class="fa fa-toggle-down"></i></button><br/><br/>
<button id="KEY_MENU" class="btn" onclick="sendButton(this.id)">Menu</button>
<button id="KEY_MEDIA" class="btn" onclick="sendButton(this.id)">Media</button><br/><br/>

<p id="console"></p>

I like this setup for it's simplicity by copying 2 files ( no install,compile or config) and was hoping to see if you can port your code to python
(possibly adding code to same 2 files above) thereby eliminating nodemcu. I have to use Raspberry Pi to capture and stream video which I do using EasyCap capture card and uv4l driver from https://www.linux-projects.org/uv4l/ .

Everything works nicely with above setup but now I want to add Sony CDR-SX85 camcorder to increase the zoom range.I live in very small town in Vermont and we are surrounded by beautiful mountains and it is fun to watch live PTZ camera and capture timelapse images. My Plan is to add both cameras on same Pan/Tilt platform. It is shame that Sony do not have IR receivers on their camcorder which cost very little additional cost to implement.

By the way I realize your town is famous for this : https://www.youtube.com/watch?v=N6QOZGgbj-g

I am following Gary's projects for long time.

Please feel free to advice in my project.

Thanks
Ken

from blackmagic-lanc.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.