Take a look at this: 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.
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:
import mraa import time import os x = mraa.Gpio(8) y = mraa.Gpio(13) x.dir(mraa.DIR_IN) y.dir(mraa.DIR_OUT) while True: if x.read() == 1: y.write(1) exit_code = os.system('node /home/root/edi-cam/web/server/server.js') else: y.write(0)
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.
Thank you very much! I hope the best for you too. If you are able to work on this in the future and you have more questions/doubts, don’t hesitate to contact us again and/or to open a new thread, we will be glad to help you.