-
Notifications
You must be signed in to change notification settings - Fork 2
/
FM_Radio.cpp
59 lines (51 loc) · 1.27 KB
/
FM_Radio.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include "FM_Radio.h"
SoftwareSerial FMSerial(A12, A13);
char fbuf[512] = {};
//FM
void FM_Init()
{
FMSerial.begin(38400);
FMSerial.setTimeout(1000);
}
//�
void SetFrequency(char *p)
{
FMSerial.write(p);
FMSerial.setTimeout(1000);
}
//
void set_FM_OnOff()
{
FMSerial.write("AT+PAUS");
}
void ReadFrequency()
{
// if (is_listen)
// {
// FMSerial.listen(); //
// delay(200);
// if (FMSerial.available())
// {
// fbuf[512] = "\0";
// char inChar = FMSerial.read();
// Serial.print("-------------------------------:");
// Serial.println(inChar);
// if (inChar == 'F') { //'F' means a new line of data
// String inString = Serial2.readStringUntil('\n');
// Serial.print(" ---------------inString:");
// Serial.println(inString);
// inString.trim();
// inString.toCharArray(fbuf, inString.length());
// }
// else if (inChar == 'V') { //'F' means a new line of data
// fbuf[512] = "\0";
// String inString = Serial2.readStringUntil('\n');
// Serial.print(" ---------------inString:");
// Serial.println(inString);
// inString.trim();
// inString.toCharArray(fbuf, inString.length());
// }
// RF_SERIAL.write(fbuf);
// }
// }
}