awesome. You’re so helpful, thank you! I used the web ide, thanks for clarifying the .cpp would be empty, that threw me off as I thought “that can’t be right…”
I wired it all up, using D2 for my DE/RE pin. I changed the TXEN variable to reflect this. Now, I used D6 for data in and D7 for data out , but could not find where to set these in the code. I’m not sure if these are the “right” pins to use.
Since I need my photon to behave as master, I also changed:
And in the setup I have this:
master.begin( 19200 ); // baud-rate at 19200
And the main loop contains:
master.poll( au16data, 16 );
So, the code compiles fine and the rest of my code is operating as normal.
Now… is there any documentation on how to proceed? Do you know of any example code I can look at?
Here is an example request I need to send to the slave device. This will read 3 registers continuous from address 100H
field name 01H
function code 03H
start address (high byte) 01H
start address (low byte) 00H
number of registers (high byte) 00H
number of registers (low byte) 03H
CRC 16 (high byte) 37H
CRC 16 (low byte) 04H
I will then get a response which I need to parse and turn the data into variables I can work with.
I’m trying to figure out if the 3x/4x limitation of this library will be an issue for my application, but I’m not quite there yet. more reading.