Posts: 1
Joined: Fri Dec 28, 2018 3:15 am

Can anyone help me out with my C# application?

Fri Dec 28, 2018 3:19 am


I have a desktop application (C#) with 2 buttons (On and Off) that writes in a file (.txt) on the Raspberry Desktop a command ("ON" or "OFF"). There is a python script(.py) that is running in background and that switch on or off a LED regarding to the command in the desktop file (.txt)

The PROBLEM is when I manually write "ON" in the desktop file (.txt) and save it (ctrl+S) the LED turns on.
When I press the On button in the desktop application (C#), it writes "ON" in the desktop file (.txt) but nothing happen with the LED...

Why does the python script(.py) ignore the "ON" or "OFF" command when it is written by the desktop application (C#)?

Thanks very much to anyone who could help me with that !!

Posts: 2
Joined: Tue Jan 15, 2019 10:30 am

Re: Can anyone help me out with my C# application?

Tue Jan 15, 2019 11:11 am

Hard to say without seeing your code etc... and i'm not a PI expert, but something that springs to mind - are you releasing the text file after you have written it? if you are using StreamWriter to write to your text file make sure the object is disposed once you have finished writing.

Return to “Other programming languages”