Noob Question: Sending Data to Serial Over CLI

I am just starting out and I am trying to write my very first test app. What I want to do is just print “Hi” onto the CLI when a key is pressed. But I am realizing that pressing of a key does not just send the data over the comm port (electron is hooked up to the USB and I am flashing using the USB / Win 10). What I am missing is a way for the CLI to just send text or anything really to the comm port. Can anyone help? Code so far:

void setup()

void loop()
while(!Serial.available()) Particle.process();
static bool wasExecuted = false;
     if (wasExecuted)
     wasExecuted = true;

particle serial monitor is only a monitor not a terminal :wink:
You can’t send serial data with this.

You’d rather need to use something like PuTTY or even just in cmd (assuming your device is registered as COM3)

echo > COM3
particle serial monitor

1 Like


Here is some code that will echo back what you send it over the serial port:

void setup() {


void loop() {
    int availableBytes = Serial.available();
    if (availableBytes > 0) {
        char message[availableBytes];
        for(int i = 0 ; i < availableBytes ; i++) {
            message[i] =;


But as @ScruffR says you cannot send data to the device using the serial monitor, only view the data written from the device.

On Ubuntu using the CLI you can use:

$> echo -e "hello world" > /dev/ttyACM0

To send the String “hello world” to the device and you will see it echoed back through the serial monitor.

Hope this is helpful!

There are tons of serial monitor programs that allow you to both send and receive but the particle serial monitor is not one of those. I just use the Arduino IDE’s built in monitor. There are probably some command line programs too

1 Like

Thanks all for the replies! This was very helpful! So, one follow-up question and then back to tinker mode for me: The reason I wanted to get this going was to use it as a standard debug tool to do things like print out the value of variables and registers ect. What does the community at large use for this? Do you guys just have a function that returns interesting variables? I’ll look into the Arduino IDE for now. Thanks again!

A quick update: I am using the Arduino IDE’s monitor and am happy as a clam!! Thank you Nimonster!

1 Like

Your welcome, for debugging I mainly publish events using Particle.publish but sometimes I use serial too. Serial is probably faster.