Newbie Can I run my own code parallel to home assistant on a RPI 4

I am totally new to Home assistant and have no system up running yet as I am on a waiting list for a RPI 4.

Home assistant will run on the RPI 4.

My project is that I have some external HW with some logical input pins pins and serial signal which I want to control.

Can I do that with the RPI 4 by running my own code parallel to Home assistant server and if so is there an example of how to do this.

Or am I to do it via an ESP


You can have an operating system and install supervised version of home assistant on it.

As long as, you don’t use IO fields from home assistant (there are some integrations for these) you can run multiple things under same raspberry pi