*please understand for my low english ability
Hello everyone. I'm a Korean student.
I want to make something with intel edison for my graduation task.
the problem is
-> i want to control cam with switch
example : switch value = 1 : video streaming on
switch value = 0 : video streaming off
i read the contents about video streaming on intel edison(with mjpg-streamer) but i can't control on/off status
my friend suggest me to control sh with mraa
but i'm not sure it is possible
i hope you to give me some nice tip. thank you.
Take a look at this: https://github.com/drejkim/edi-cam https://github.com/drejkim/edi-cam. This is a step by step tutorial for get a live video streaming on Intel Edison. I suggest you to run this tutorial first and check how responds your camera with your Edison.
Once that you have been able to run the code and see the video streaming on your web browser, I think a good approach will be reading the digital pin connected to the switch, with this you can create a code that will run the server.js only when the pin is high or low.
If you want to use the microswitch on the Arduino Expansion Board I suggest you to run a bash script that runs the command lsusb to verify the position of the microswitch.
I appreciate for your kindness.
In fact, i already read that post(edi-cam) and complete the video streaming.
I also created the code and implement by running node.js
but i still don't know how to control the status of cam.
i can turn on or off the streaming the cam by typing the instruction(through serial or wi-fi connection) but i can't do this by state of switch.
unfortunately we can't use arduino expansion board because we are planning to make a wearable device(arduino board is too big to use.)
I don't have a alternative method so i think i have to study and approach by other way.
thank for your kindness again.
Once that your code have detected a change in the pin (your switch) you can use a system call and run the server.
http://rosettacode.org/wiki/Execute_a_system_command# Python http://rosettacode.org/wiki/Execute_a_system_command# Python
You can also use an if instance but you have to check that the system call is not being executed over and over again. For example with a code like:
x = mraa.Gpio(8)
y = mraa.Gpio(13)
if x.read() == 1:
exit_code = os.system('node /home/root/edi-cam/web/server/server.js')
The system call is inside of the While loop, even if the code is detecting when the 8 pin is high or low it will run the server over and over again and this will not work.
I hope this gives you an idea on how to continue with your project.
I can't try this right now because i'm in far place from school.
but i think your tip is correct answer. i really thank you.
Due to my low English and engineering skills, i couldn't find correct way to prove this problem.
but you gave me a lot information and tip.now, i think i can solve this problem(Thank for your tip)
again, i really thank you. I pray for your happiness.
your student Jisoo.