hello
This commit is contained in:
parent
07074ca0ec
commit
9da65e8dc1
@ -24,7 +24,7 @@ def main():
|
|||||||
camera.start_recording(output, format='mjpeg')
|
camera.start_recording(output, format='mjpeg')
|
||||||
try:
|
try:
|
||||||
server = ps.Streamer(address, StreamProps)
|
server = ps.Streamer(address, StreamProps)
|
||||||
print('Server started at','http://'+address[0]+':'+str(address[1]))
|
print('Camera serving started at','http://'+address[0]+':'+str(address[1]))
|
||||||
server.serve_forever()
|
server.serve_forever()
|
||||||
finally:
|
finally:
|
||||||
camera.stop_recording()
|
camera.stop_recording()
|
||||||
|
33
main.py
33
main.py
@ -2,40 +2,7 @@ from flask import Flask
|
|||||||
import RPi.GPIO as gpio
|
import RPi.GPIO as gpio
|
||||||
from time import sleep
|
from time import sleep
|
||||||
import subprocess
|
import subprocess
|
||||||
import picamera
|
|
||||||
import pyshine as ps # pip3 install pyshine==0.0.9
|
|
||||||
|
|
||||||
# Camera server
|
|
||||||
def camera():
|
|
||||||
HTML="""
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>PyShine Live Streaming</title>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<center><h1> PyShine Live Streaming using OpenCV </h1></center>
|
|
||||||
<center><img src="stream.mjpg" width='640' height='480' autoplay></center>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
"""
|
|
||||||
|
|
||||||
StreamProps = ps.StreamProps
|
|
||||||
StreamProps.set_Page(StreamProps,HTML)
|
|
||||||
address = ('0.0.0.0',9000) # Enter your IP address
|
|
||||||
StreamProps.set_Mode(StreamProps,'picamera')
|
|
||||||
with picamera.PiCamera(resolution='640x480', framerate=30) as camera:
|
|
||||||
output = ps.StreamOut()
|
|
||||||
StreamProps.set_Output(StreamProps,output)
|
|
||||||
camera.rotation = 90
|
|
||||||
camera.start_recording(output, format='mjpeg')
|
|
||||||
try:
|
|
||||||
server = ps.Streamer(address, StreamProps)
|
|
||||||
print('Camera serving started at','http://'+address[0]+':'+str(address[1]))
|
|
||||||
server.serve_forever()
|
|
||||||
finally:
|
|
||||||
camera.stop_recording()
|
|
||||||
|
|
||||||
# MQ-135 gas sensor
|
# MQ-135 gas sensor
|
||||||
def stinker():
|
def stinker():
|
||||||
gpio.setmode(gpio.BCM)
|
gpio.setmode(gpio.BCM)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user