commit all
parent
8aae0c2754
commit
84d1c68b5d
@ -0,0 +1,29 @@
|
||||
//
|
||||
// ÓïÒôʶ±ðÄ£¿é - ¡°Ð¡´´¡±
|
||||
//
|
||||
|
||||
#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);
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
// VoiceReportCommand.h
|
||||
|
||||
#ifndef _VOICEIDENTIFYCOMMAND_h
|
||||
#define _VOICEIDENTIFYCOMMAND_h
|
||||
|
||||
#if defined(ARDUINO) && ARDUINO >= 100
|
||||
#include "arduino.h"
|
||||
#else
|
||||
#include "WProgram.h"
|
||||
#endif
|
||||
|
||||
#include <BKRC_Voice.h>
|
||||
#include "TextEncoder.h"
|
||||
|
||||
class VoiceIdentifyCommand
|
||||
{
|
||||
private:
|
||||
uint8_t RandomDisc();
|
||||
public:
|
||||
bool CMD_ReportAndIdentify();
|
||||
void CMD_ReportAnyText(String text);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
// VoiceRepotCommand.h
|
||||
|
||||
#ifndef _VOICEREPOTCOMMAND_h
|
||||
#define _VOICEREPOTCOMMAND_h
|
||||
#ifndef _VOICEREPORTCOMMAND_h
|
||||
#define _VOICEREPORTCOMMAND_h
|
||||
|
||||
#if defined(ARDUINO) && ARDUINO >= 100
|
||||
#include "arduino.h"
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue