Hello how can I send some data through the serial monitor on Platformio?
How can I input in the serial monitor data to read?
thanks
const int BUFFER_SIZE = 100;
char buf[BUFFER_SIZE];
void setup() {
Serial.begin(115200); // opens serial port, sets data rate to 115200 bps
}
void loop() {
// check if data is available
if (Serial.available() > 0) {
// read the incoming bytes:
int rlen = Serial.readBytesUntil('\n', buf, BUFFER_SIZE);
// prints the received data
Serial.print("I received: ");
for(int i = 0; i < rlen; i++)
Serial.print(buf[i]);
}
}