Go Down

Topic: Arduino + Other Device - talking to each other (Read 2879 times) previous topic - next topic

fakeviolist

Jul 03, 2013, 07:21 pm Last Edit: Jul 03, 2013, 07:29 pm by fakeviolist Reason: 1
Hello, I am trying to get an Arduino Uno and a Melexis Development Board (specifically the MLX90130) to talk to each. I have them hooked up together, but am not able to get them to speak to each other yet.

The code I have for the Arduino is:
Code: [Select]
#include <SoftwareSerial.h>

SoftwareSerial mySerial =  SoftwareSerial(10,11);

void setup() {
 
 Serial.begin(2400);
 mySerial.begin(2400);
 
}

void loop() {
 if (mySerial.isListening())
   Serial.println("Melexis is listening!");
   
 delay(1500);
   
 if (mySerial.available())
   Serial.write("Melexis is available!");
 
 Serial.print('\n');
 
 mySerial.listen();
 mySerial.write(0100);

 Serial.write(mySerial.read());

 delay(1000);
}


The mySerial.write(0100); is a command sent to the Melexis; the 0100 is requesting basic information from the MLX90130, but I am not getting anything back. All that comes out in the Serial Moniter is "Melexis is listening!" repeatedly, and also a "ÿ" symbol. Could someone shed some light as to why they aren't speaking?

sonnyyu


...
and also a "ÿ" symbol. Could someone shed some light as to why they aren't speaking?


You are not alone and should be proud who with you.



http://www.fcc.gov/document/consumer-alert-using-or-importing-jammers-illegal

batch of "Ÿ" at documnet,  FCC does not know how to encode UTF-8?


kDodman

Data sheet for the MLX90130 says the default baud rate is 57600, your code is trying to connect at 2400

AWOL

Code: [Select]
mySerial.write(0100);
That is odd - I would expect '@'

ÿ usually indicates 255 (-1)
Code: [Select]
Serial.write(mySerial.read());
Yes, that would do it.
"Pete, it's a fool (who) looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

AWOL

Quote
I don't think the Arduino is receiving any data

If mySerial.read is always returning -1, then that may be the case, but it will be difficult to see with all those ÿ scrolling past.
Why don't you check to see if there is something to read before reading it?
"Pete, it's a fool (who) looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

AWOL

I don't understand - aren't the '@' meant to provoke a response?
Now you're only sending them if you've had a response.
"Pete, it's a fool (who) looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

PaulS

Quote
I'm wondering why I can't get a response then.

Because with your latest code, you are expecting the other board to initiate communication. It's not surprising that it does not.

You do have the two board's grounds connected, right?
The art of getting good answers lies in asking good questions.

PaulS

Quote
I still get back the y-like character.

I doubt that the y like character IS the response. It is more likely that the y like character is result of reading something that isn't there. Post your new code, and a link to the device you are talking to.
The art of getting good answers lies in asking good questions.

Go Up