Skip to content

Commit 918cf51

Browse files
author
noah-jonathan rosa
committed
Added VirtualCOMPort example
1 parent e486aed commit 918cf51

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
volatile uint8_t fromPC[16];
2+
volatile uint8_t fromGNSS[16];
3+
volatile unsigned long idxPC = 0;
4+
volatile unsigned long idxGNSS = 0;
5+
6+
#ifdef ARDUINO_ARCH_STM32
7+
HardwareSerial Serial1(PA10, PA9);
8+
#endif
9+
10+
void setup() {
11+
Serial.begin(115200);
12+
Serial1.begin(115200);
13+
pinMode(7, OUTPUT);
14+
digitalWrite(7, LOW);
15+
delay(1000);
16+
digitalWrite(7,HIGH);
17+
delay(50);
18+
}
19+
20+
21+
void loop() {
22+
if(Serial.available()){
23+
fromPC[idxPC]= Serial.read();
24+
Serial1.write(fromPC[idxPC]);
25+
idxPC++;
26+
idxPC %= 16;
27+
}
28+
if(Serial1.available()){
29+
fromGNSS[idxGNSS]= Serial1.read();
30+
Serial.write(fromGNSS[idxGNSS]);
31+
idxGNSS++;
32+
idxGNSS %= 16;
33+
}
34+
}

0 commit comments

Comments
 (0)