How to use this c-code to read out my photovoltaic?

Hi,

i found some c-code to read out my photovoltaic on this forum:

Can someone help me, how i can use this code in openhab?

I don´t know how i can use this c-code on my debian linux. Do i have to make a c-program out of this code or can i use some parts of this code with maybe the exec-command?

If i have to use this c-code in a program, how can i make a program out of this code? Is this like making a batch / script file or do i have to compile this? I have never done this before. Can anybode help me?

I just scrolled through the Forum.
I’m no expert for C, but as I see it, you have two options for this:

  1. start the logger from openhab using the exec-command (there seems no Output, which could be used?)
  2. just use the data in the mysql-db

As I see it, the logger starts and writes the readings directly to the database. You could change the code to write the readings in the console, so you could use it within openhab - or you could just use the data from MySQL-DB.

Hi,

how can i use the code in a programm? If i copy the code into my editor and save it as for example “logger.c” can i start it with simply enter the name on the linux console?

you must at first compile the Code:

sudo make

should do the trick. You ought to have a “logger”-file next to your “logger.c”, the logger can then be executed like ./logger