Go Down

Topic: visual basic serial communication (Read 13 times) previous topic - next topic

cbrandy

Hi Graynomad.
I get the value when I use serial command in Arduino compiler.
The serialport I use is com6.

Its just the Rx I don't get...   :-[

Graynomad

Quote
I get the value when I use serial command in Arduino compiler.

Meaning? What value? What "serial" command? Be specific, we haven't just gone through the same thought processes that you have. For example I've spent the last few minutes looking into isolated RS-485 chips  :)

Something like "I get the 'A' when using the serialRead() command" is more useful.

If that is the case then for the purposes of this post your loop is

void loop(){
     Serial.println(int(Thermistor(analogRead(0))));
}

Change it to

Serial.println("x");

and see if you get the xs on the IDE serial monitor.

As I said,

Quote
Have you verified that the Arduino is actually sending anything?


______
Rob



Rob Gray aka the GRAYnomad www.robgray.com

cbrandy

Hi Graynomad
What I mean, is when I use arduino compiler and hit serial monitor, I get the temperature.

But when I ran the code you posted, I got some value from temp now. But the value from temp didn't change when I put heat on it.

If I understand it right, when I program arduino like "Serial.print"
This is what it sends to serial port?

Is there a way in VB to take spesific code from serial signal.
Like in this code I use one sensor sending value to VB.
If I had several sensors, like sensor 1-sensor6 could I split the code so I could place the value where I need it, and how?

Back to question.

The temp sensor I have, I'd like to show in a TextBox. Refreshing every 20 sec.
In my code showed above, how can I do this?

Best,
-Andy  :)

Graynomad

#8
Jan 19, 2011, 06:03 pm Last Edit: Jan 19, 2011, 06:06 pm by graynomad Reason: 1
Quote
What I mean, is when I use arduino compiler and hit serial monitor, I get the temperature.


That's good, sounds like the Arduino is sending the data correctly.

Quote
But when I ran the code you posted,

Suitably modified I hope.

Quote
But the value from temp didn't change when I put heat on it.

Was the value reasonable, or rediculous like 5000 degrees.

Quote
If I understand it right, when I program arduino like "Serial.print"
This is what it sends to serial port?

Correct.

Quote
In my code showed above,


Code: [Select]
Set DTR and RTS
.DtrEnable = True
.RtsEnable = True


I don't think you want to enable the hardware handshaking, get rid of these lines. VB is probably waiting for DTR or RTS to be set.

Quote
how can I do this?

Something like

Code: [Select]
s = SerialPort1.ReadLine()
TextBox1.Text = TextBox1.Text + s + vbCrLf


______
Rob

Rob Gray aka the GRAYnomad www.robgray.com

cbrandy

Thanks Rob.
Now I've got some code to work.
Each time I push the buttom, I'll get some temp value  :D

Next I'll try to get the temp to show from startup and update in a periode of 30sec.

Again Rob. Thank you for helping me   :)

Go Up