You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
RaceSubCar/VoiceIdentifyCommand.cpp

30 lines
542 B
C++

//
// ÓïÒôʶ±ðÄ£¿é - ¡°Ð¡´´¡±
//
#include "VoiceIdentifyCommand.h"
uint8_t VoiceIdentifyCommand::RandomDisc()
{
randomSeed(micros());
return random(0x00, 0x07);
}
bool VoiceIdentifyCommand::CMD_ReportAndIdentify()
{
uint8_t source = RandomDisc();
uint8_t result = BKRC_Voice.BKRC_Voice_Extern(source);
return (source == (result - 0x01));
}
void VoiceIdentifyCommand::CMD_ReportAnyText(String text)
{
TextEncoder encoder(text);
while (encoder.HasNextChar())
{
byte data[2] = { 0 };
Serial2.write(data, 2);
delay(500);
}
}