Maxzy
Hello, i was testing something out and i don't know if it's runtime problem or slave problem but when i did basic LD and uploaded it to runtime, whenever you push a button coil doesn't respond . any tips ? I'm using Arduino mega as slave, and raspberry pi as hardware  PLC.png  PLC2.png 
Reply 0 0
thiagoralves
This is weird. The fact that the button is true in the picture means that slave device communication is working fine, because it is getting the state of the Arduino input pin. It intrigues me that the output remains false, as this is an internal runtime operation and doesn’t depend on the Arduino or any external communication. It appears as if the program the runtime is running is different than the program you build on the ladder logic. Could you post here the .st file you’re trying to upload? When you upload it, are there any compilation errors?
Reply 0 0
Maxzy
Yea it is weird, first I tried doing bigger project, but i noticed that some coil pin outs not responding as it should be so i did smaller one. 
This is what it says on compiling program:
Optimizing ST program...
Generating C files...
POUS.c
POUS.h
LOCATED_VARIABLES.h
VARIABLES.csv
Config0.c
Config0.h
Res0.c
Moving Files...
Compiling for Raspberry Pi
Generating object files...
Generating glueVars...
varName: __IX100_0 varType: BOOL
varName: __QX100_0 varType: BOOL
Compiling main program...
hardware_layer.cpp:31:10: fatal error: wiringPi.h: No such file or directory
31 | #include <wiringPi.h>
| ^~~~~~~~~~~~
compilation terminated.
Error compiling C files
Compilation finished with errors!
Reply 0 0
Maxzy
Here is the file
Reply 0 0
thiagoralves
That's why:
Maxzy wrote:

Compiling main program...
hardware_layer.cpp:31:10: fatal error: wiringPi.h: No such file or directory
31 | #include <wiringPi.h>
| ^~~~~~~~~~~~
compilation terminated.
Error compiling C files
Compilation finished with errors!

It is failing to compile your programs, which means it is not running what you uploaded, but whatever was in there before it that successfully compiled.

Compilation is failing because you don't have wiringPi installed on your Raspberry Pi. Either you install wiringPi or you use the Blank hardware driver instead. Keep in mind that with the Blank driver you won't be able to control the Pi's GPIO pins
Reply 0 0
Maxzy
Oh thanks,! i'll try that, i though wiringPi was like an extra program for better communication, but it looks like without it, raspberry can't see wiring .
Reply 0 0
Maxzy
Hello again , I installed WiringPi on raspberry and it looks like it worked but there is other issue, I noticed that coils are turning true and false without pushing button and my question is if i should use different Type then BOOL ? I Tried to redo my LD like 10 times 😃 still some of the coils turns true without a reason.
Reply 0 0
thiagoralves
Reason is probably static. Check your circuit. You probably left your inputs without pull down resistors 
Reply 0 0
Maxzy
Thank you for your replies i only worked with Schneider plc so it's kinda new to me, i'll do some research 🙂 .
Reply 0 0
Reply