Make file:

hello: cc hello.c `pkg-config –cflags –libs libmodbus`

//SourceCode:
#include <stdio.h>
#include <modbus/modbus.h>
int main(void) {
  modbus_t *mb;
  uint16_t tab_reg[32];
  mb = modbus_new_tcp("127.0.0.1", 1502);
  modbus_connect(mb);
  /* Read 5 registers from the address 0 */
  modbus_read_registers(mb, 0, 5, tab_reg);
  modbus_close(mb);
  modbus_free(mb);
}

compile:

gcc hello.c -o hello -lmodbus

./hello


//Install modbus

sudo apt update

sudo apt install libmodbus-dev


https://www.youtube.com/watch?v=Z5rFghRi568

https://www.youtube.com/watch?v=Q0fldVY3s6c

https://www.youtube.com/watch?v=bWXRTOnOiE8&list=PLqUqfqqOTDzItDIEFG9PxYm_rGGGK8lXF

https://www.process.st/how-to/connect-raspberry-pi-to-microsoft-remote-desktop/#:~:text=On%20the%20Raspberry%20Pi%2C%20open,Pi%20as%20a%20remote%20device.

sudo apt update

sudo apt install libmodbus-dev


https://libmodbus.org/getting_started/

https://www.cs.colby.edu/maxwell/courses/tutorials/maketutor/ => Make file

https://www.electronicshub.org/raspberry-pi-l298n-interface-tutorial-control-dc-motor-l298n-raspberry-pi/

https://lastminuteengineers.com/l298n-dc-stepper-driver-arduino-tutorial/ (Interface L298N DC Motor Driver Module with Arduino)

https://www.collvy.com/blog/controlling-dc-motor-with-raspberry-pi (Controlling DC Motor With Raspberry Pi)

https://stackoverflow.com/questions/29602698/create-a-simple-client-server-using-modbus-in-c

https://learn.sparkfun.com/tutorials/raspberry-gpio/c-wiringpi-example

https://www.youtube.com/results?search_query=Pulse-Width-Modulation+with+Raspberry+Pi

https://www.youtube.com/watch?v=G6EaI1RL42I