import sensor import time import mjpeg import machine sensor.reset() # Reset and initialize the sensor. sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240) sensor.skip_frames(time=2000) # Wait for settings take effect. led = machine.LED("LED_RED") while True: led.on() m = mjpeg.Mjpeg("example.mjpeg") clock = time.clock() # Create a clock object to track the FPS. for i in range(5*60*30): clock.tick() m.add_frame(sensor.snapshot()) print(clock.fps()) m.close(clock.fps()) led.off() print("saved")