I use both of the codes, in the first one i connect the sensor to the Rx and Tx on the arduino. When i use the second code i connect them to the 10 and 11 pins (that pins are used in the code)
I didn't send you the code because is the same like in the link I have attached. The connection of the arduino and the sensor is also like in the article.
//*The RX pin on the sensor connects to pin 10 on the Arduino
//*The TX pin on the sensor connects to pin 11 on the Arduino
SoftwareSerial PMSerial(10, 11); // RX, TX
This has the Uno RX to the sensor RX and Uno TX to sensor TX. In the hardware serial example Uno RX goes to sensor TX and Uno TX to sensor RX.
I believe the hardware serial example is right.
Try swapping the RX and TX so that Uno RX (pin 10) goes to sensor TX and Uno TX (pin 11) goes to sensor RX.
This has the Uno RX to the sensor RX and Uno TX to sensor TX. In the hardware serial example Uno RX goes to sensor TX and Uno TX to sensor RX.
I believe the hardware serial example is right.
Try swapping the RX and TX so that Uno RX (pin 10) goes to sensor TX and Uno TX (pin 11) goes to sensor RX.
Yes, I know. That is how I connect them.
I'm starting to think that the problem is the sensor (highly unlikely), or maybe the cables. How can I check the cables ?
[quote author=vampirstajn link=msg=3506627 date=1512060167]
Yes, I know. That is how I connect them.
So you connect them (slightly) different than in the example after all...
That's why we always ask "how did YOU connect it?". Same for the software - even seemingly innocent pin number changes can be highly relevant - so that's why the question: what is the software YOU are running?
I'm starting to think that the problem is the sensor (highly unlikely), or maybe the cables. How can I check the cables ?
Swap them out for other wires.
Connect it to a known-good Serial device, such as the Serial monitor. You should see the communication, but may be not human readable.
Connect the device to a known-good host (swap out a working sensor with yours).
So it was not wired as in the tutorial. Well, if you had provided the wiring diagram that I requested in reply #1 (of your setup), I would not have wasted my time typing reply #4.