Qualeams / Android-Face-Recognition-with-Deep-Learning-Library

Face Recognition library for Android devices is an Android library (module) which includes several face recognition methods.
Apache License 2.0
371 stars 135 forks source link

Raspberry pi and DF player. #38

Closed codingyoutub closed 2 years ago

codingyoutub commented 2 years ago

In arduino, the dfplayer worked well and Raspberry connected to HC05 Bluetooth and it worked very well.

However, Raspberry and FDplayer are not allowed. Can you look at the chords?

`import serial import time

MP3_PLAYBACK_SOURCE = 0x09 MP3_VOLUME = 0x06 MP3_PLAYBACK_SOURCE_TF = 1

global send default_buf = [0x7E,0xFF, 0x06, 0x00, 0x00, 0x00, 0x00,0x00,0x00, 0xEF] mp3_cmd_buf = [0x7E,0xFF, 0x06, 0x00, 0x00, 0x00, 0x00,0x00,0x00, 0xEF]

global ser ser = serial.Serial( port='/dev/ttyAMA1', baudrate=9600, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize= serial.EIGHTBITS, timeout=1 )

global loop loop = False

def dfplayer_init(): mp3_send_cmd(MP3_PLAYBACK_SOURCE, 0, MP3_PLAYBACK_SOURCE_TF) time.sleep(0.01) mp3_send_cmd(MP3_VOLUME, 0, 30) time.sleep(0.01)

def Volume(v): mp3_send_cmd(MP3_VOLUME, 0, v)

def Play(): global loop loop = True mp3_send_cmd(0x12, 0, 1)

def NextPlay(): global loop loop = True mp3_send_cmd(0x01, 0, 0)

def Stop(): global loop if loop: loop = False mp3_send_cmd(0x16, 0, 1)

def mp3_send_cmd(cmd, high_arg, low_arg): mp3_cmd_buf[3] = cmd mp3_cmd_buf[5] = high_arg mp3_cmd_buf[6] = low_arg checksum = MP3_checksum() mp3_cmd_buf[7] = ((checksum >> 8) & 0x00FF) print(mp3_cmd_buf[7]) mp3_cmd_buf[8] = (checksum & 0x00FF) print(mp3_cmd_buf[8]) for i in range(10): USART_Transmit(mp3_cmd_buf[i]) mp3_cmd_buf[i] = default_buf[i]

def MP3_checksum(): sum =0 for i in range(1,7): sum += mp3_cmd_buf[i] return -sum

def USART_Transmit(data): global ser print(chr(data)) ser.write(bytes(data))

dfplayer_init() NextPlay()`