almost finish main
This commit is contained in:
parent
185ced388b
commit
0bf91c38a8
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "windows-gcc-x64",
|
||||||
|
"includePath": [
|
||||||
|
"${workspaceFolder}/**"
|
||||||
|
],
|
||||||
|
"compilerPath": "gcc",
|
||||||
|
"cStandard": "${default}",
|
||||||
|
"cppStandard": "${default}",
|
||||||
|
"intelliSenseMode": "windows-gcc-x64",
|
||||||
|
"compilerArgs": [
|
||||||
|
""
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version": 4
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "C/C++ Runner: Debug Session",
|
||||||
|
"type": "cppdbg",
|
||||||
|
"request": "launch",
|
||||||
|
"args": [],
|
||||||
|
"stopAtEntry": false,
|
||||||
|
"externalConsole": true,
|
||||||
|
"cwd": "c:/Users/siwat/Desktop/src",
|
||||||
|
"program": "c:/Users/siwat/Desktop/src/build/Debug/outDebug",
|
||||||
|
"MIMode": "gdb",
|
||||||
|
"miDebuggerPath": "gdb",
|
||||||
|
"setupCommands": [
|
||||||
|
{
|
||||||
|
"description": "Enable pretty-printing for gdb",
|
||||||
|
"text": "-enable-pretty-printing",
|
||||||
|
"ignoreFailures": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
{
|
||||||
|
"C_Cpp_Runner.cCompilerPath": "gcc",
|
||||||
|
"C_Cpp_Runner.cppCompilerPath": "g++",
|
||||||
|
"C_Cpp_Runner.debuggerPath": "gdb",
|
||||||
|
"C_Cpp_Runner.cStandard": "",
|
||||||
|
"C_Cpp_Runner.cppStandard": "",
|
||||||
|
"C_Cpp_Runner.msvcBatchPath": "",
|
||||||
|
"C_Cpp_Runner.useMsvc": false,
|
||||||
|
"C_Cpp_Runner.warnings": [
|
||||||
|
"-Wall",
|
||||||
|
"-Wextra",
|
||||||
|
"-Wpedantic",
|
||||||
|
"-Wshadow",
|
||||||
|
"-Wformat=2",
|
||||||
|
"-Wcast-align",
|
||||||
|
"-Wconversion",
|
||||||
|
"-Wsign-conversion",
|
||||||
|
"-Wnull-dereference"
|
||||||
|
],
|
||||||
|
"C_Cpp_Runner.msvcWarnings": [
|
||||||
|
"/W4",
|
||||||
|
"/permissive-",
|
||||||
|
"/w14242",
|
||||||
|
"/w14287",
|
||||||
|
"/w14296",
|
||||||
|
"/w14311",
|
||||||
|
"/w14826",
|
||||||
|
"/w44062",
|
||||||
|
"/w44242",
|
||||||
|
"/w14905",
|
||||||
|
"/w14906",
|
||||||
|
"/w14263",
|
||||||
|
"/w44265",
|
||||||
|
"/w14928"
|
||||||
|
],
|
||||||
|
"C_Cpp_Runner.enableWarnings": true,
|
||||||
|
"C_Cpp_Runner.warningsAsError": false,
|
||||||
|
"C_Cpp_Runner.compilerArgs": [],
|
||||||
|
"C_Cpp_Runner.linkerArgs": [],
|
||||||
|
"C_Cpp_Runner.includePaths": [],
|
||||||
|
"C_Cpp_Runner.includeSearch": [
|
||||||
|
"*",
|
||||||
|
"**/*"
|
||||||
|
],
|
||||||
|
"C_Cpp_Runner.excludeSearch": [
|
||||||
|
"**/build",
|
||||||
|
"**/build/**",
|
||||||
|
"**/.*",
|
||||||
|
"**/.*/**",
|
||||||
|
"**/.vscode",
|
||||||
|
"**/.vscode/**"
|
||||||
|
],
|
||||||
|
"C_Cpp_Runner.useAddressSanitizer": false,
|
||||||
|
"C_Cpp_Runner.useUndefinedSanitizer": false,
|
||||||
|
"C_Cpp_Runner.useLeakSanitizer": false,
|
||||||
|
"C_Cpp_Runner.showCompilationTime": false,
|
||||||
|
"C_Cpp_Runner.useLinkTimeOptimization": false,
|
||||||
|
"C_Cpp_Runner.msvcSecureNoWarnings": false
|
||||||
|
}
|
Binary file not shown.
Binary file not shown.
|
@ -3,50 +3,66 @@ from time import sleep, perf_counter
|
||||||
from time import sleep as delay
|
from time import sleep as delay
|
||||||
|
|
||||||
class access_control:
|
class access_control:
|
||||||
|
"""
|
||||||
|
This class provides methods to control access to a door using an ESPMega board.
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
"""
|
||||||
|
Initializes an instance of the access_control class.
|
||||||
|
"""
|
||||||
self.plc = ESPMega("/facescan","192.168.0.239",1883)
|
self.plc = ESPMega("/facescan","192.168.0.239",1883)
|
||||||
|
|
||||||
|
|
||||||
# def light_on(self):
|
|
||||||
# self.plc.analog_write(0,1,4095)
|
|
||||||
# def light_off(self):
|
|
||||||
# self.plc.analog_write(0,0,4095)
|
|
||||||
# def get_door_state(self) -> bool:
|
|
||||||
# return self.plc.digital_read(0)
|
|
||||||
# def get_scan_state(self) -> bool:
|
|
||||||
# return self.plc.digital_read(1)
|
|
||||||
# def lock_door(self):
|
|
||||||
# if(self.get_door_state()):
|
|
||||||
# self.plc.analog_write(1,1,4095)
|
|
||||||
|
|
||||||
# def unlock_door(self):
|
|
||||||
# self.plc.analog_write(1,0,4095)
|
|
||||||
|
|
||||||
|
|
||||||
def get_scan_state(self) -> bool:
|
def get_scan_state(self) -> bool:
|
||||||
|
"""
|
||||||
|
Returns the state of the scan sensor.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
bool: True if the scan sensor is active, False otherwise.
|
||||||
|
"""
|
||||||
return self.plc.digital_read(1)
|
return self.plc.digital_read(1)
|
||||||
|
|
||||||
def lock_door(self): #if door close, lock the door.
|
def lock_door(self):
|
||||||
|
"""
|
||||||
|
Locks the door if it is closed.
|
||||||
|
"""
|
||||||
if(self.plc.digital_read(0)):
|
if(self.plc.digital_read(0)):
|
||||||
self.plc.digital_write(0,0)
|
self.plc.digital_write(0,0)
|
||||||
|
|
||||||
|
def unlock_door(self):
|
||||||
def unlock_door(self): #if door close, unlock the door.
|
"""
|
||||||
|
Unlocks the door if it is closed.
|
||||||
|
"""
|
||||||
if(self.plc.digital_read(0)):
|
if(self.plc.digital_read(0)):
|
||||||
self.plc.digital_write(0,1)
|
self.plc.digital_write(0,1)
|
||||||
|
|
||||||
def get_door_state(self) -> bool:
|
def get_door_state(self) -> bool:
|
||||||
|
"""
|
||||||
|
Returns the state of the door.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
bool: True if the door is closed, False otherwise.
|
||||||
|
"""
|
||||||
return self.plc.digital_read(0)
|
return self.plc.digital_read(0)
|
||||||
|
|
||||||
def activate_alarm(self):
|
# def activate_alarm(self):
|
||||||
self.plc.digital_write(1,1)
|
# """
|
||||||
|
# Activates the alarm.
|
||||||
|
# """
|
||||||
|
# self.plc.digital_write(2,1)
|
||||||
|
|
||||||
def activate_LED_alarm(self):
|
def activate_alarm(self):
|
||||||
|
"""
|
||||||
|
Activates the LED alarm.
|
||||||
|
"""
|
||||||
|
self.plc.digital_write(2,1)
|
||||||
while(True):
|
while(True):
|
||||||
self.plc.digital_write(1,round((perf_counter()*2)%1))
|
self.plc.digital_write(1,round((perf_counter()*2)%1))
|
||||||
print(round((perf_counter()*2)%1))
|
print(round((perf_counter()*2)%1))
|
||||||
delay(0.1)
|
delay(0.3)
|
||||||
if self.get_door_state():
|
if self.get_door_state():
|
||||||
self.lock_door()
|
self.lock_door()
|
||||||
|
self.plc.digital_write(1,0)
|
||||||
|
self.plc.digital_write(2,0)
|
||||||
break
|
break
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
import time
|
||||||
|
from time import perf_counter
|
||||||
|
|
||||||
|
time_count = time.perf_counter()
|
||||||
|
endtime = time_count + 10
|
||||||
|
|
||||||
|
while (time_count < endtime):
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
import cv2
|
import cv2
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
|
@ -16,6 +17,7 @@ db = Database()
|
||||||
|
|
||||||
global img
|
global img
|
||||||
global frame_ready
|
global frame_ready
|
||||||
|
|
||||||
frame_ready = False
|
frame_ready = False
|
||||||
|
|
||||||
def read_webcam():
|
def read_webcam():
|
||||||
|
@ -37,6 +39,38 @@ faces = None
|
||||||
|
|
||||||
threading.Thread(target=read_webcam).start()
|
threading.Thread(target=read_webcam).start()
|
||||||
|
|
||||||
|
|
||||||
|
def door_open():
|
||||||
|
actrl.unlock_door()
|
||||||
|
for i in range(10):
|
||||||
|
display.set_string("msg.txt",f'Door will close in {10-i}')
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
i = 5
|
||||||
|
#TODO Check if door close, lock
|
||||||
|
alarm_active: bool = False
|
||||||
|
display.set_page("leftopen")
|
||||||
|
while(i>=0):
|
||||||
|
if (not actrl.get_door_state() and not alarm_active): # False door is left open
|
||||||
|
|
||||||
|
display.set_string("msg.txt","Door is left open, Alram in {} sec".format(i))
|
||||||
|
time.sleep(1)
|
||||||
|
i -= 1
|
||||||
|
if i == 0:
|
||||||
|
actrl.activate_alarm()
|
||||||
|
display.set_string("msg.txt","Alarm Active, Please Close Door.")
|
||||||
|
#actrl.activate_LED_alarm()
|
||||||
|
|
||||||
|
elif(actrl.get_door_state()):
|
||||||
|
actrl.lock_door()
|
||||||
|
display.set_page("scan")
|
||||||
|
should_restart = True
|
||||||
|
break
|
||||||
|
#display.set_page("scan")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
while not frame_ready:
|
while not frame_ready:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
@ -57,11 +91,13 @@ while True:
|
||||||
facefile = faces[0]['name'] ## File name
|
facefile = faces[0]['name'] ## File name
|
||||||
print(facefile)
|
print(facefile)
|
||||||
student_info = db.get_student_info(facefile)## Check is it student?
|
student_info = db.get_student_info(facefile)## Check is it student?
|
||||||
|
parent_info = db.get_parent_info(facefile)
|
||||||
if(student_info!=None): #is student, request another scan for parent
|
if(student_info!=None): #is student, request another scan for parent
|
||||||
print("Find student info")
|
print("Find student info")
|
||||||
#db.log_access_student_file()
|
#db.log_access_student_file()
|
||||||
|
parent_info = None
|
||||||
display.set_page("student")
|
display.set_page("student")
|
||||||
display.set_string("msg.txt","Scan parent face")
|
#display.set_string("msg.txt",f'Scan parent face ({10-i})')
|
||||||
display.set_string("name_std.txt", f'Name: {student_info.name}')
|
display.set_string("name_std.txt", f'Name: {student_info.name}')
|
||||||
display.set_string("surname_std.txt",f'Surname: {student_info.surname}')
|
display.set_string("surname_std.txt",f'Surname: {student_info.surname}')
|
||||||
display.set_string("id_std.txt", f'ID: {str(student_info.id)}')
|
display.set_string("id_std.txt", f'ID: {str(student_info.id)}')
|
||||||
|
@ -70,18 +106,16 @@ while True:
|
||||||
parent_info = db.get_parent_info(parent_face)"""
|
parent_info = db.get_parent_info(parent_face)"""
|
||||||
#DONE TODO Fill in student info Resolve
|
#DONE TODO Fill in student info Resolve
|
||||||
|
|
||||||
time.sleep(1)
|
|
||||||
print(student_info)
|
print(student_info)
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
while(i <= 10):
|
start_time = time.perf_counter()
|
||||||
|
while(time.perf_counter()-start_time < 10):
|
||||||
parent_face = fp.identify_face(img, target_condidence=0.6)
|
parent_face = fp.identify_face(img, target_condidence=0.6)
|
||||||
|
|
||||||
if (len(parent_face)!= 0):
|
if (len(parent_face)!= 0):
|
||||||
parent_facefile = parent_face[0]['name']
|
parent_facefile = parent_face[0]['name']
|
||||||
parent_info = db.get_parent_info(parent_facefile)
|
parent_info = db.get_parent_info(parent_facefile)
|
||||||
print(i)
|
|
||||||
i += 1
|
|
||||||
if(parent_info != None): # Identified parent
|
if(parent_info != None): # Identified parent
|
||||||
if(db.check_relationship(student_info,parent_info)): # Check if the detected parent is right for the detected student.
|
if(db.check_relationship(student_info,parent_info)): # Check if the detected parent is right for the detected student.
|
||||||
print("Relation is OKAY")
|
print("Relation is OKAY")
|
||||||
|
@ -95,6 +129,8 @@ while True:
|
||||||
actrl.unlock_door() # Door open
|
actrl.unlock_door() # Door open
|
||||||
display.set_string("msg.txt","Get your kid")
|
display.set_string("msg.txt","Get your kid")
|
||||||
#DONE TODO Send timer to display
|
#DONE TODO Send timer to display
|
||||||
|
door_open()
|
||||||
|
"""
|
||||||
for i in range(10):
|
for i in range(10):
|
||||||
display.set_string("msg.txt",f'Door will close in {10-i}')
|
display.set_string("msg.txt",f'Door will close in {10-i}')
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
@ -117,40 +153,46 @@ while True:
|
||||||
should_restart = True
|
should_restart = True
|
||||||
break
|
break
|
||||||
display.set_page("scan")
|
display.set_page("scan")
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
display.set_page("scan")
|
display.set_page("scan")
|
||||||
display.set_string("msg.txt","Wrong parent. \t Try Again")
|
display.set_string("msg.txt","Wrong parent. \t Try Again")
|
||||||
time.sleep(2)
|
time.sleep(1)
|
||||||
should_restart = True
|
should_restart = True
|
||||||
break
|
break
|
||||||
#TODO Try again does not try again
|
#TODO Try again does not try again
|
||||||
|
|
||||||
else:
|
elif(len(parent_face) == 0):
|
||||||
display.set_page("student")
|
|
||||||
display.set_string("msg.txt","Cannot find parent data. \t Try Again")
|
|
||||||
should_restart = True
|
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
display.set_string("msg.txt",f'Scan parent face ({10-i})')
|
||||||
|
i += 1
|
||||||
|
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
else:
|
display.set_page("scan")
|
||||||
#TODO is this a parent?
|
|
||||||
|
|
||||||
parent_facefile = parent_face[0]['name']
|
elif(parent_info!=None): #is parent, open door
|
||||||
parent_info = db.get_parent_info(parent_facefile)
|
#parent_facefile = faces[0]['name']
|
||||||
|
#parent_info = db.get_parent_info(parent_facefile)
|
||||||
|
#if(parent_info!= None):
|
||||||
|
display.set_page("prt_wo_stu")
|
||||||
|
display.set_string("name_pt.txt", f'Name: {parent_info.name}')
|
||||||
|
display.set_string("surname_pt.txt", f'Surname: {parent_info.surname}')
|
||||||
|
display.set_string("id_pt.txt", f'ID: {parent_info.id}')
|
||||||
|
|
||||||
|
door_open()
|
||||||
|
|
||||||
display.set_page("student")
|
|
||||||
display.set_string("msg.txt","Cannot find student data. \t Try Again")
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
elif (len(faces)>1):
|
elif (len(faces)>1):
|
||||||
#More than one people, error.
|
#More than one people, error.
|
||||||
print("more than one people. \t try again")
|
print("more than one people. \t try again")
|
||||||
display.set_string("msg.txt","More than one people. \t try again")
|
display.set_string("msg.txt","More than one people. \t try again")
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
pass
|
pass
|
||||||
print("DONE")
|
#print("DONE")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
display.set_string("msg.txt","Move your face closer to the scanner")
|
display.set_string("msg.txt","Move your face closer to the scanner")
|
||||||
|
|
|
@ -45,59 +45,66 @@ while True:
|
||||||
facefile = faces[0]['name'] ## File name
|
facefile = faces[0]['name'] ## File name
|
||||||
student_info = db.get_student_info(facefile)## Check is it student?
|
student_info = db.get_student_info(facefile)## Check is it student?
|
||||||
if(student_info!=None): #is student, request another scan for parent
|
if(student_info!=None): #is student, request another scan for parent
|
||||||
#db.log_access_student_file()
|
time_count = time.perf_counter()
|
||||||
time.sleep(2)
|
endtime = time_count + 10
|
||||||
display.set_page("student")
|
while (time_count != endtime):
|
||||||
display.set_string("msg.txt","Scan parent face")
|
#db.log_access_student_file()
|
||||||
parent_face = fp.identify_face(img, target_condidence=0.6)
|
time_count = time.perf_counter()
|
||||||
parent_info = db.get_parent_info(parent_face)
|
time.sleep(1)
|
||||||
#DONE TODO Fill in student info Resolve
|
display.set_page("student")
|
||||||
display.set_page("student")
|
display.set_string("msg.txt","Scan parent face")
|
||||||
display.set_string("name_std.txt", student_info.name)
|
parent_face = fp.identify_face(img, target_condidence=0.6)
|
||||||
display.set_string("surname_std.txt", student_info.surname)
|
parent_info = db.get_parent_info(parent_face)
|
||||||
display.set_string("id_std.txt", student_info.id)
|
#DONE TODO Fill in student info Resolve
|
||||||
|
display.set_page("student")
|
||||||
|
display.set_string("name_std.txt", student_info.name)
|
||||||
|
display.set_string("surname_std.txt", student_info.surname)
|
||||||
|
display.set_string("id_std.txt", student_info.id)
|
||||||
|
time_count = time.perf_counter()
|
||||||
|
|
||||||
if(parent_info != None): # Identified parent
|
if(parent_info != None): # Identified parent
|
||||||
if(db.check_relationship(student_info,parent_info)): # Check if the detected parent is right for the detected student.
|
if(db.check_relationship(student_info,parent_info)): # Check if the detected parent is right for the detected student.
|
||||||
#DONE TODO Log Access STDw/P
|
#DONE TODO Log Access STDw/P
|
||||||
db.log_access_student_with_parent(student_info, student_info)
|
db.log_access_student_with_parent(student_info, student_info)
|
||||||
#DONE TODO write parrent info to display
|
#DONE TODO write parrent info to display
|
||||||
display.set_page("student")
|
display.set_page("student")
|
||||||
display.set_string("name_std.txt", parent_info.name)
|
display.set_string("name_std.txt", parent_info.name)
|
||||||
display.set_string("surname_std.txt", parent_info.surname)
|
display.set_string("surname_std.txt", parent_info.surname)
|
||||||
display.set_string("id_std.txt", parent_info.id)
|
display.set_string("id_std.txt", parent_info.id)
|
||||||
access_control.unlock_door() # Door open
|
access_control.unlock_door() # Door open
|
||||||
display.set_string("msg.txt","Get your kid")
|
display.set_string("msg.txt","Get your kid")
|
||||||
#TODO Send timer to display
|
#TODO Send timer to display
|
||||||
#display.set_page("student")
|
#display.set_page("student")
|
||||||
i = 10
|
i = 10
|
||||||
while(i>=1):
|
while(i>=1):
|
||||||
display.set_string("msg.txt","Door will close in {}".format(i))
|
display.set_string("msg.txt","Door will close in {}".format(i))
|
||||||
time.sleep(1)
|
|
||||||
i -= 1
|
|
||||||
actrl.lock_door()
|
|
||||||
|
|
||||||
i = 10
|
|
||||||
#TODO Check if door close, lock
|
|
||||||
while(i>=0):
|
|
||||||
|
|
||||||
if (not actrl.get_door_state()): # False door is left open
|
|
||||||
display.set_string("msg.txt","Door is left open, Alram in {} sec".format(i))
|
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
i -= 1
|
i -= 1
|
||||||
if i == 0:
|
|
||||||
actrl.activate_alarm()
|
|
||||||
else:
|
|
||||||
actrl.lock_door()
|
actrl.lock_door()
|
||||||
break
|
|
||||||
|
|
||||||
|
i = 10
|
||||||
|
#TODO Check if door close, lock
|
||||||
|
while(i>=0):
|
||||||
|
|
||||||
|
if (not actrl.get_door_state()): # False door is left open
|
||||||
|
display.set_string("msg.txt","Door is left open, Alram in {} sec".format(i))
|
||||||
|
time.sleep(1)
|
||||||
|
i -= 1
|
||||||
|
if i == 0:
|
||||||
|
actrl.activate_alarm()
|
||||||
|
else:
|
||||||
|
actrl.lock_door()
|
||||||
|
break
|
||||||
|
|
||||||
|
else:
|
||||||
|
display.set_page("scan")
|
||||||
|
display.set_string("msg.txt","Wrong parent. \t Try Again")
|
||||||
|
#TODO Try again does not try again
|
||||||
else:
|
else:
|
||||||
display.set_page("scan")
|
display.set_page("student")
|
||||||
display.set_string("msg.txt","Wrong parent. \t Try Again")
|
display.set_string("msg.txt","Cannot find parent data. \t Try Again")
|
||||||
#TODO Try again does not try again
|
should_start = True
|
||||||
else:
|
|
||||||
display.set_page("student")
|
|
||||||
display.set_string("msg.txt","Cannot find parent data. \t Try Again")
|
|
||||||
else:
|
else:
|
||||||
display.set_page("student")
|
display.set_page("student")
|
||||||
display.set_string("msg.txt","Cannot find student data. \t Try Again")
|
display.set_string("msg.txt","Cannot find student data. \t Try Again")
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
import serial
|
||||||
|
|
||||||
|
ser = serial.Serial('COM13', 115200)
|
||||||
|
while True:
|
||||||
|
data = b''
|
||||||
|
while True:
|
||||||
|
byte = ser.read()
|
||||||
|
if byte == b'\x03':
|
||||||
|
break
|
||||||
|
data += byte
|
||||||
|
|
||||||
|
data_str = data.decode('utf-8')
|
||||||
|
print(data_str)
|
|
@ -1,27 +1,5 @@
|
||||||
|
|
||||||
# from espmega.espmega_r3 import ESPMega_standalone as ESPMega
|
from espmega.espmega_r3 import ESPMega_standalone as ESPMega
|
||||||
# import time
|
plc = ESPMega("/facescan","192.168.0.239",1883)
|
||||||
# import math
|
|
||||||
|
|
||||||
# plc = ESPMega("/facescan","192.168.0.239",1883)
|
plc.digital_write(2,0)``
|
||||||
|
|
||||||
# i = 0
|
|
||||||
|
|
||||||
# # while True:
|
|
||||||
# # #print(plc.digital_read(0))
|
|
||||||
# # i= round(4095* abs(math.sin(time.perf_counter()*3.14)))
|
|
||||||
# # print(i)
|
|
||||||
# # plc.analog_write(1, 1,i)
|
|
||||||
# # time.sleep(0.1)
|
|
||||||
|
|
||||||
|
|
||||||
# while True:
|
|
||||||
# plc.digital_write(1,1)
|
|
||||||
# time.sleep(1)
|
|
||||||
# plc.digital_write(1,0)
|
|
||||||
# time.sleep(1)
|
|
||||||
|
|
||||||
from time import perf_counter
|
|
||||||
|
|
||||||
while True:
|
|
||||||
print(round((perf_counter()/2)%1))
|
|
|
@ -5,7 +5,7 @@
|
||||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-1659844131497362565" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="1011834129611985212" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||||
</provider>
|
</provider>
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-1659844131497362565" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="1011834129611985212" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||||
</provider>
|
</provider>
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue