FacePalmGamer
✅ Making custom Events
I am working with a pi using the System.Device.Gpio. is there a way to create an event for when a pin changes?
I have never worked with making events only ever subscribed to known events, so i don't know if you even can, but I dont see why you couldn't.
the GPIO library has 2 functions. waitForEvent, and waitForEventAsync. Previously I just made a task list like this: (This is a poor rendition, these functions would do alot more)
this seems wrong, and if I could just make a pinChange event and subscribe a method to it, it would be alot easier. Effectively like an interrupt.
TLDR
What is the correct way to look for pin chages? should i just stick with making a list of tasks, or is there a way to make an event system for pin changes?
8 replies
✅ Compile with bat file
Is there an easy way to compile and run in a bat file? I have a discord bot I am messing around with, and I am trying to make it redeploy itself whenever a github push is made. I can already detect when a push is made by just looking for the webhook post in a channel, then I know how to pull from git in batch, but I'm not sure how to compile the code then start the program.
I read something about the csc command, but I'm not sure how to install that on my pc or use it really
5 replies
✅ Correct way to pass data between threads?
I have an event on a simple Winform reading from the serial port. The issue is I would like to output the data onto a winform component, but because its on an even it happens on a different thread and I get the error
Cross-thread operation not valid: Control 'textBoxRecieve' accessed from a thread other than the thread it was created on.
so what is the correct way to pass this data? I know I could do something like a channel do make a cross thread communication system, but that seems excessive and I figure there is an easier way I do now know
That was the function running and erroring. I was just trying to make a simple ECHO test
debugListen.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler);
and that is how I was setting up the event80 replies