Hello umm sorry but im new to this how will I know if its incorrect baud rate and slave address?
originally this is what I am trying to do
but since it didn't give the correct feedback, it has come to my conclusion that there must be a problem with my RS485? the diagram in the link is what it looked at first I just remove the sensor, because I'm trying to see if the Rs485 will give me my byte request
Ah, the perennial soil sensor project. A major problem is that there are many variations of soil sensors, some are compatible some are not. So unless you have the exact same sensor as the article, you will likely run into problems.
If you don't have the exact same sensor, then you will need a detailed datasheet for it, giving default baud rate, slave address, Modbus register addresses.
Personally I would start this project with a Modbus slave I know works, then I can test the software and connections work as expected. Then the only variable is the actual slave I want to talk to. You can simulate a Modbus slave with another Arduino, so it does not have to be expensive.
It also helps to have a scope or logic analyzer to really confirm the comms is as expected.
oh hello, so I change the whole code to this because I'm focusing on the RS485 and to see if it will output my bud request which suppose to give me this