I have a Raspberry Pi running a Web server and I'd like to be able to create a web interface to change the colors and images on my RGB display.
I control the RGB display by navigating to the directory and executing a python file and it lights up, it ends up looking like
pi#raspberrypi: sudo python test.py
Cool, it works! But how can I execute this on my pi webserver, I don't even know where to begin. What sort of framework can I use to accomplish my goal here?
You could use for example flask or bottle. I like flask, which i use on my webserver. By the way it is also an Raspberry Pi. I think the most framework have a developer server, so you haven‘t set up a ‚real‘ webserver.
Maybe you could use Jupyter Notebook too, but i didn‘t try it on my Pi.
Related
So me and my friend are working on this project where a raspberry pi with certain sensors collects some data and outputs it.
Now, we want certain parameters to be passed on runtime. So we were thinking of creating a react-native app which could connect with the Pi using Bluetooth. Once connected, it could then send the arguments over Bluetooth.
The python script would then intercept these arguments and then run its program and then send its output back to the app.
While searching for libraries to help me with this, I came across this library: https://github.com/Polidea/react-native-ble-plx
While going through the documentation, I came across https://github.com/Polidea/react-native-ble-plx/wiki/Characteristic-Writing, which seems to be the method used for writing some data and sending it.
In Bluetooth terms, what exactly are these services and characteristics and do I have to create my own service and characteristic while working on my project? Or can I write to any existing characteristic so that the python script can read that?
If I have wrongly understood certain concepts, please correct me. Also if there are any better ways to architect this approach please let me know
Currently, there is no official Expo Bluetooth API. I looked up the same library you are looking at and I find it a little complicated.
I found this link https://askubuntu.com/questions/838697/share-files-between-2-computers-via-bluetooth-from-terminal, where you could open up one terminal and use Bluetoothctl to connect to a specific device. Now, open up another terminal and use the bluetooth-sendto --device= MAC:ADDRESS (read that link) to send the file from Raspberry Pi to a phone (I tested on Android and it worked).
You could also send data from the phone to Raspberry Pi. Again, check out that link.
I am writing a web python application with tornado framework on a raspberry pi.
What i actually do is to connect to my raspberry with ssh. I am writing my source code with vi, on the raspberry.
What i want to do is to write source code on my development computer but i do not know how to synchronize (transfer) this source code to raspberry.
It is possible to do that with ftp for example but i will have to do something manual.
I am looking for a system where i can press F5 on my IDE and this IDE will transfer modified source files. Do you know how can i do that ?
Thanks
Some IDEs like JetBrains PyCharm are supporting automatically file upload via ssh/scp/ftp.
Following a couple of bad experiences where I lost code which was only on my Pi's SD card, I now run WinSCP on my laptop, and edit files from Pi on my laptop, they open in Notepad++ and WinSCP automatically saves edits to Pi. And also I can use WinSCP folder sync feature to copy contents of SD card folder to my latop. Not perfect, but better what I was doing before
I have done this before using bitbucket as a standard repository and it is not too bad. If you set up cron scripts to git pull it's almost like continuous integration.
On my RPi (b model) Flask is installed.
I can access the webpage "It works" via another browser on another computer.
Works great. As well on my LAN as from the outside world.
And also, I can write and run Python scripts and let it act as server and so on.
But how do I enable my own Python script for Flask as standard at boot from RPi.
It's seated in the /home/pi/myproject dir and I'd like it to be standard.
I can't find the standard python script and templates to replace.
Any help is welcome.
I have an application written in Python using numpy and OpenCV. Currently I am using OpenCV's GUI functionality; however, I'm finding it has various issues and behaves differently across platforms. I would like to build a browser interface. The application includes a live video feed and its state is updated about once every 1/15th of a second-- I would need the browser display to update at this rate. What is a good tool to accomplish this? I have built small apps in EmberJS but I think that getting it to communicate with Python is too much overhead.
You probably want to connect your app to a Python web framework like Flask so that you can make a restful interface. You could then build a frontend app in Angular or Backbone that queries the server for every update.
lately I have been trying to find a way to control applications on my ubuntu using python. What i want to achieve is something like what we can do with applescript in mac.... Control chrome send queries to it etc.
can someone please point me in the right direction as to how one can control applications using python, esp on Ubuntu...or a code snippet maybe?
Read about D-Bus: http://en.wikipedia.org/wiki/D-Bus
Python dbus: http://dbus.freedesktop.org/doc/dbus-python/doc/tutorial.html
In order to control a process, it must be connected using dbus in the first place and exporting services. This is the same idea of AppleScript. On a mac, an application has to be exporting services that can be controlled over applescript.
PyQt/PySide has a DBus module as well: http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qtdbus.html
Have you taken a look at Project Sikuli?