How to view M2 from Arduino IDE

I am new to Arduinos and up to this point I have just uploaded software to my M2 and connected to it Via SavvyCan.

Using Arduino IDE 1.8.5 I can upload the sketches fine.

Blinky works fine…

When I try to open up the serial monitor and actually see what is going on I don’t see anything. From what I understand it should just start printing but my monitor has nothing in it…

I have tried using this Sketch, uploading it and setting the monitor to 9600 baud. Should print out “Hello World” But I am getting a blank screen.

Have tried this with both of my M2 units and both my desktop and laptop.

I am guessing I am missing something simple…

Here is the sketch I am running:

void setup()                    // run once, when the sketch starts
{
  Serial.begin(9600);           // set up Serial library at 9600 bps
}

void loop()                       // run over and over again
{
  Serial.println("Hello world!");  // prints hello with ending line break
  delay(1000);
}

Try using

SerialUSB.begin(115200); // This is the Native USB port of the DUE
delay(2000); // Delay 2 seconds to allow the USB port to initialise

Serial.print() tries to print to the serial port which in the case of the M2 is the XBEE socket.

Thank you so much!

That was the ticket!

I figured it had to be something simple that I wasn’t getting.

SerialUSB instead of Serial…

So I take it then if you have a bluetooth serial connection then Serial.print would print to that.

In theory yes in practice generally no because you are more likely to use Serial.read() & Serial.write() & Serial,event() because you may be manipulating the Serialbuffer or using the serial interrupt rather than polling the serial port looking for data.
If you intend to talk to a Bluetooth XBEE device i would suggest you brush up on the serial functions in the Arduino playground & also do a little light reading in some of the other ancillary functions listed there which will point you in the right direction,

1 Like

Thank you. I am a ways from that yet but I am learning…