Unfortunately I such a noob I'm not seeming to implement it correctly.
The zip contains modbuslave.h and modbuslave.cpp.
I am used to loading a .pde file.
the .h file has what looks like a arduino sketch. But when i paste it into IDE and try to compile it throws all kinds of errors. It also calls(includes) the .h file so that seems circular and not correct to me.
I've been reading and googling for a bunch of hours now and each time I think I get it I dont.
Can somebody give me some tips to get this to actually compile so I can get to the next step in my hobby project?
so every time im about to put this thing back on the shelf for another few months I break through.
I was able to get this to compile: using modbusslave from here: Embedded stuff
in modbusslave.cpp theres a sample sketch. After commenting out the ... it compiles.
#include <ModbusSlave.h>
//Arduino sketch example with 2 holding regs:
void setup()
{
/* Modbus setup example, the master must use the same COM parameters */
/* 115200 bps, 8N1, two-device network */
regs[MB_REG0]=123;
regs[MB_REG1]=456;
init_mb_slave(115200, 'n', 0);
}
void loop()
{
/* This is all for the Modbus slave */
start_mb_slave(MB_SLAVE, regs, MB_REGS);
/* your code goes here */
// ...
/* handle write event */
if (written.num_regs) {
/// ....
written.num_regs=0;
}
}
whoo hoo.
Now obviously I'm supposed to put something in the "your code here" areas.
Sooooo, what goes there?
If I could find any kind of docs or somewhere to start but my searches dont bringup anything helpful.
My end game is to communicate with Mango
I got as far as writing that tutorial and realized I didnt want to use Mango. Switched to PHP serial and havent looked back. The mango forums are pretty good. you may want to ask over there.