File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change 8
8
// Use Serial1 for UART communication
9
9
HardwareSerial mySerial (2 );
10
10
11
- // Buffer for serial data
12
- std::vector<uint8_t > serialBuffer;
13
11
bool readingPacket = false ;
14
12
15
13
void handleMyByte (uint8_t byte)
@@ -31,21 +29,21 @@ void loop()
31
29
// Check if data is available to read
32
30
if (mySerial.available ())
33
31
{
34
- uint8_t incomming = mySerial.read ();
32
+ uint8_t incoming = mySerial.read ();
35
33
36
- if (!readingPacket && incomming != END_BYTE)
34
+ if (!readingPacket && incoming != END_BYTE)
37
35
{
38
36
readingPacket = true ;
39
- handleMyByte (incomming );
37
+ handleMyByte (incoming );
40
38
}
41
39
else
42
40
{
43
41
// forward the data
44
- Serial.print (String (incomming ) + " " );
45
- mySerial.write (incomming );
42
+ Serial.print (String (incoming ) + " " );
43
+ mySerial.write (incoming );
46
44
}
47
45
48
- if (incomming == END_BYTE)
46
+ if (incoming == END_BYTE)
49
47
{
50
48
Serial.println (" End of packet" );
51
49
readingPacket = false ;
You can’t perform that action at this time.
0 commit comments