Hey guys,
I would like your help in this, perhaps small matter, please.
Beforehand I say that I'm not an advanced programmer in both these languages, that's why I'm posting here.
I'm trying to send some values through the interface I've created in VB2008 to the Arduino.
First off, I seem to don't be able to use the serial scope on Arduino when I have an open connection between VB2008 and Arduino which is very inconvenient, is that normal? Is there any practical way around this?
And second, then I want to send some values let's say 70 20 0.6. So VB2008 will send them all in a row and the problem on the receiver's side (Arduino) is that using the following code:
int incomingByte = 0; // for incoming serial data
void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}
void loop() {
// send data only when you receive data:
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();
// say what you got:
Serial.print("I received: ");
Serial.println(incomingByte, DEC);
}
}
it saves every number to a variable therefore separating the values I want.
So the approach I take next is to send each value terminated with a character, lets say '-'. Now, on the receiver's side I try to collect the numbers I'm receiving in a string until I get the '-'. And this is working. So finally, the problem is being to store these strings with the value I want in an int or a float variable.
Can you give me some advice, please? And also if there is a much better way to solve this, please let me know.
Thanks