Good day, how can i simulate a rasberry pi camera. i want the camera to take a picture when a button is pressed and store the pictures in MySQL database
tried with the following code and displaying the picture on the tft screen but unfortunately after some time the simulation will timeout.
# !/usr/bin/env python3
# Modules
from goto import with_goto
from stddef import *
import var
import pio
import resource
from datetime import datetime
# Peripheral Configuration Code (Do Not Edit)
#---CONFIG_BEGIN---
import cpu
import FileStore
import VFP
import Generic
import camera
import Displays
def peripheral_setup () :
# Peripheral Constructors
pio.cpu=cpu.CPU ()
pio.storage=FileStore.FileStore ()
pio.server=VFP.VfpServer ()
pio.BTN1=Generic.Button (pio.GPIO19)
pio.CAM1=camera.RPiCamera ()
pio.LCD1=Displays.TFTDisplay (pio.GPIO25, pio.GPIO24)
pio.storage.begin ()
pio.server.begin (0)
# Install interrupt handlers
def peripheral_loop () :
pio.server.poll ()
#---CONFIG_END---
def variables_setup () :
# Flowchart Variables
var.image = ''
# Flowchart Routines
@with_goto
def chart_SETUP () :
pio.LCD1.loadImage ("picturestart.png", 0)
return
@with_goto
def chart_LOOP () :
while not (pio.BTN1()) :
pass
pio.CAM1.capture (25)
var.image = pio.CAM1.getLastImage ()
pio.LCD1.loadImage (var.image, 0)
return
# Main function
def main () :
# Setup
variables_setup ()
peripheral_setup ()
chart_SETUP ()
# Infinite loop
while True :
peripheral_loop ()
chart_LOOP ()
# Command line execution
if __name__ == '__main__' :
main()