|
1 | | -/* |
2 | | - SoftwareSerial TX Only test |
3 | | -
|
4 | | - If your application is transmit only then setting |
5 | | - #define _SS_TX_ONLY 1 |
6 | | - Will stop the library allocating a GPIO interrupt and save 1364 bytes of memory |
7 | | - */ |
8 | | -#define _SS_TX_ONLY 1 // Transmit only (Rx pin is unused/unassigned, but still needs a number) |
9 | | -#define _SS_MAX_RX_BUFF 128 // Increase the Rx buffer to 128 bytes (default is 64 bytes) |
10 | | -#include <SoftwareSerial.h> |
11 | | - |
12 | | -SoftwareSerial SoftSerial(2, 3); // RX, TX |
13 | | - |
14 | | -uint32_t t; |
15 | | -bool hb_state = false; // heartbeat |
16 | | - |
17 | | -void setup() |
18 | | -{ |
19 | | - pinMode(LED_BUILTIN, OUTPUT); |
20 | | - SoftSerial.begin(9600); |
21 | | - SoftSerial.println(__FILE__); |
22 | | - SoftSerial.println(__TIME__); |
23 | | - t = millis(); |
24 | | -} |
25 | | - |
26 | | -void loop() |
27 | | -{ |
28 | | - if (millis() - t > 1000) |
29 | | - { |
30 | | - t = millis(); |
31 | | - digitalWrite(LED_BUILTIN, hb_state); |
32 | | - hb_state = !hb_state; |
33 | | - SoftSerial.print("."); |
34 | | - } |
35 | | - |
36 | | - yield(); |
| 1 | +/* |
| 2 | + SoftwareSerial TX Only test |
| 3 | +
|
| 4 | + If your application is transmit only then setting |
| 5 | + #define _SS_TX_ONLY 1 |
| 6 | + Will stop the library allocating a GPIO interrupt and save 1432 bytes of memory |
| 7 | + */ |
| 8 | +#define _SS_TX_ONLY 1 // Transmit only (Rx pin is unused/unassigned, but still needs a number) |
| 9 | +#define _SS_MAX_RX_BUFF 128 // Increase the Rx buffer to 128 bytes (default is 64 bytes) |
| 10 | +#include <SoftwareSerial.h> |
| 11 | + |
| 12 | +SoftwareSerial SoftSerial(2, 3); // RX, TX |
| 13 | + |
| 14 | +uint32_t t; |
| 15 | +bool hb_state = false; // heartbeat |
| 16 | + |
| 17 | +void setup() |
| 18 | +{ |
| 19 | + pinMode(LED_BUILTIN, OUTPUT); |
| 20 | + SoftSerial.begin(9600); |
| 21 | + SoftSerial.println(__FILE__); |
| 22 | + SoftSerial.println(__TIME__); |
| 23 | + t = millis(); |
| 24 | +} |
| 25 | + |
| 26 | +void loop() |
| 27 | +{ |
| 28 | + if (millis() - t > 1000) |
| 29 | + { |
| 30 | + t = millis(); |
| 31 | + digitalWrite(LED_BUILTIN, hb_state); |
| 32 | + hb_state = !hb_state; |
| 33 | + SoftSerial.print("."); |
| 34 | + } |
| 35 | + |
| 36 | + yield(); |
37 | 37 | } |
0 commit comments