-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathesp8266-rf-distort.ino
59 lines (47 loc) · 926 Bytes
/
esp8266-rf-distort.ino
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
/**
* @file config.h
* @author Ali Nasrolahi (a.nasrolahi01@gmail.com)
* @brief esp8266-rf-distortion.
* @date 2023-05-19
*/
/* AS1000F data pin */
#define RF_DATA_PIN D3
/* Pulses */
#define PULSE_CNT 3
/* starts from 10khz */
#define BASE_FREQ 10
/* Sequences */
#define SEQ 50
/* Sleep macro */
#ifdef ESP8266
#define sleep os_delay_us
#else
/* modify according to your chip */
#define delay_us
#endif
#define WAVE_LENGTH (1000 * 1000 / BASE_FREQ * 2)
uint8_t seq;
void bring_up()
{
digitalWrite(RF_DATA_PIN, HIGH);
sleep(WAVE_LENGTH * seq);
}
void drag_down()
{
digitalWrite(RF_DATA_PIN, LOW);
sleep(WAVE_LENGTH * seq);
}
void setup()
{
pinMode(RF_DATA_PIN, OUTPUT);
digitalWrite(RF_DATA_PIN, LOW);
}
void loop()
{
for (seq = 1; seq <= SEQ; seq++) {
for (int pulse = 0; pulse < PULSE_CNT; pulse++) {
bring_up();
drag_down();
};
};
};