How to use serial.print( ) to display data on computer screen?

hello everyone.
I am using a core to control a chip via i2c and i am try to display the data get from the chip on my macbook.
i use wire.read( ) and then serial.print( ), but i have no idea what to do next.

shall i use cli or what?

really grateful to anyone can give me an idea on this.
@Moors7 @kennethlimcp

You need Serial.begin(9600) in your setup() and use a serial terminal like Putty or Coolterm to connect and view the data.

thanks for the quick reply, new to this area is there any tutorials that i can follow?

I can write one quickly…


void setup(){
    Serial.begin(9600);
}

void loop(){
    Serial.println(Wire.read());
}

Something like that.

er i mean putty or coolterm, never heard of before.

Google it?

2 Likes

okay thanks i’ll come back if there is more difficulties

hello again, i read some introductions about both software and them seems far beyond my need. is there any commands in curl or command line that can display the data which core gets ?

You might want to spec out what you are trying to do and the approach so that we know what tools you can use.

  • Serial --> Serial terminal
  • Spark.publish --> Dashboard/CLI
  • Spark.variable --> CLI

hi
So now my situation is I have my core connected to a chip via i2c(D0 and D1 i suppose ), core sends command to chip and chip generates data, i want to check whether the data is good enough before next procession. What i am trying to do is fetch these data and display them on my computer. I use wire.read to fetch the data to core but have no idea what to do next.

cheers
bob

Bob,

i mentioned above so do read it.

Consider using Serial so you need Serial.print() to get the data displayed on a Serial terminal program. That’s the easiest way.

You might want to look for some offline help instead considering how new you are to Arduino in general.

particle serial monitor Should also work from the CLI. Give that a try.

1 Like

This code works nicely for me using particle serial monitor:

#define ledPin D7
int i = 0;

void setup() {
    Serial.begin(9600);
    pinMode(ledPin, OUTPUT);
}

void loop() {
    Serial.print("Hello, this is iteration:");
    Serial.println(i);
    digitalWrite(ledPin, !digitalRead(ledPin));
    i++;
    delay(1000);
}

hi there, sry for the late reply, it works perfectly, cheers!

1 Like

Perhaps I’m doing something wrong. I have my particle electron connected to my computer and I’ve flashed
the code below to it, however, when I type particle serial monitor, I get serial: no devices avail via serial

#define ledPin D7
int i = 0;

void setup() {
    Serial.begin(9600);
    pinMode(ledPin, OUTPUT);
}

void loop() {
    Serial.print("Hello, this is iteration:");
    Serial.println(i);
    digitalWrite(ledPin, !digitalRead(ledPin));
    i++;
    delay(1000);
}

What OS are you using?

Windows 10

Do you see the device in Dev Manager?
What’s the device name in Dev Manager?
What COM port is is registered as?

With 10 it shouldn’t be required, but you could also install these
https://s3.amazonaws.com/spark-website/Particle.zip

1 Like

Looks like the WINUSB driver from ZADIG wasn’t assigning a COM port. Now that I used the particle drivers. The electron shows up as COM5 and Serial.Print works great. Thanks for the help!

3 Likes