U
@kidswong999 import sensor, image, time, mjpeg, pyb
RED_LED_PIN = 1
BLUE_LED_PIN = 3
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others)
sensor.skip_frames(10) # Let new settings take affect.
clock = time.clock() # Tracks FPS.
pyb.LED(RED_LED_PIN).on()
sensor.skip_frames(30) # Give the user time to get ready.
pyb.LED(RED_LED_PIN).off()
pyb.LED(BLUE_LED_PIN).on()
m = mjpeg.Mjpeg("test1.mjpeg")
#mjpeg.Mjpeg(filename, width=Auto, height=Auto)创建一个mjpeg对象,
#filename为保存mjpeg动图的文件路径
print("You're on camera!")
for i in range(200):
clock.tick()
m.add_frame(sensor.snapshot())
#mjpeg.add_frame(image, quality=50)
#quality为视频压缩质量。
print(clock.fps())
m.close(clock.fps())
pyb.LED(BLUE_LED_PIN).off()
print("Done! Reset the camera to see the saved recording.")
测试的例程,重新上电还是一样0字节