Hi I have a Pi with acclerometer set up and functioning.
The issue i'm trying to solve is that I want the Rasp Pi to play videos, and for the acclerometer to control that.
So for example if I have a set of 5 videos.If the device (Pi) with the acclerometer is tilted left it would play video 1 and of it was titled right it would play video 2.
I have tested the acclerometer in Python , made the videos, and I an idea of what kind of code I could use the get this feature running, and after I get the code to set up a serial communication between Python and Processing.
I am a complete newb to pi/coding in general.
Re: Acclerometer, Processing and Python
There does not appear to be a question in your post.
Re: Acclerometer, Processing and Python
possibly you look for this kind of codexephos wrote:with the acclerometer is tilted left it would play video 1 and of it was titled right it would play video 2.
I have tested the acclerometer in Python , made the videos, and I an idea of what kind of code I could use the get this feature running
Code: Select all
#!/usr/bin/env python3
# test start omx video player from python
import subprocess
print("try start OMX player")
subprocess.call(['omxplayer','--win','100,100,560,420','/opt/vc/src/hello_pi/hello_video/test.h264'])
nano py3_omx_start.py
chmod +x py3_omx_start.py
./py3_omx_start.pytry start OMX player
Video codec omx-h264 width 1920 height 1080 profile 77 fps 25.000000
Subtitle count: 0, state: off, index: 1, delay: 0
V:PortSettingsChanged: 1920x1080@25.00 interlace:0 deinterlace:0 anaglyph:0 par:1.00 display:0 layer:0 alpha:255 aspectMode:0
have a nice day

Re: Acclerometer, Processing and Python
Thanks, for the info. Would I be able to control the video player with the accelerometer using this?KLL wrote: ↑Mon Apr 30, 2018 9:46 ampossibly you look for this kind of codexephos wrote:with the acclerometer is tilted left it would play video 1 and of it was titled right it would play video 2.
I have tested the acclerometer in Python , made the videos, and I an idea of what kind of code I could use the get this feature runningshould run as is on any RASPBIAN Desktop like from terminal:Code: Select all
#!/usr/bin/env python3 # test start omx video player from python import subprocess print("try start OMX player") subprocess.call(['omxplayer','--win','100,100,560,420','/opt/vc/src/hello_pi/hello_video/test.h264'])
nano py3_omx_start.py
chmod +x py3_omx_start.py
./py3_omx_start.pytry start OMX player
Video codec omx-h264 width 1920 height 1080 profile 77 fps 25.000000
Subtitle count: 0, state: off, index: 1, delay: 0
V:PortSettingsChanged: 1920x1080@25.00 interlace:0 deinterlace:0 anaglyph:0 par:1.00 display:0 layer:0 alpha:255 aspectMode:0
have a nice day![]()
Re: Acclerometer, Processing and Python
Are you suggesting, making a Python (or other program) to act as a menu to launch some videos.?
Which parts do you have working?
- Using the the accelerometer as a selector (joystick/arrow keys)
So you can print out which video you would like to launch.
You could look for the 'g' rating, polling with if,elseif,...
Or setup Events on something happening.
-launching a video (as given above)
-Replacing the prints in the selector, with the launching of the video.
I don't know what 'processing' has to do with this (or what it really does).
Which parts do you have working?
- Using the the accelerometer as a selector (joystick/arrow keys)
So you can print out which video you would like to launch.
You could look for the 'g' rating, polling with if,elseif,...
Or setup Events on something happening.
-launching a video (as given above)
-Replacing the prints in the selector, with the launching of the video.
I don't know what 'processing' has to do with this (or what it really does).
Re: Acclerometer, Processing and Python
I did not know that python could play video , so i was going to use processing the video. I'm very new so my workflow is going to be all over the place. Processing is a software that mainly deals with coding media, like images, to do various things.bensimmo wrote: ↑Thu May 10, 2018 4:22 pmAre you suggesting, making a Python (or other program) to act as a menu to launch some videos.?
Which parts do you have working?
- Using the the accelerometer as a selector (joystick/arrow keys)
So you can print out which video you would like to launch.
You could look for the 'g' rating, polling with if,elseif,...
Or setup Events on something happening.
-launching a video (as given above)
-Replacing the prints in the selector, with the launching of the video.
I don't know what 'processing' has to do with this (or what it really does).
I have gotten the acclerometer interfaced and tested that its working with media. Here is a video of me using the Python game to control a teapot with the acclerometer.
https://youtu.be/Qz6EJ7XX7bE
In layman's terms I want to have a way to load a bunch of video with a suitable program and then control which video is played by moving the acclerometer.
I appreciate you lot's help and patience with me, I'm just trying to figure this out.