How much professional assistance can I receive on an undergraduate capstone design project without cheating?
I have not asked my professor directly about this yet (there's still time, though!) since I've been afraid of self-incriminating and that I may be asked to remove the code which would put me back to my major snag that I can't solve.


There is not a lot of guidance that we can give you on this question as outsiders.  Your professor is the one who has set the assignment, and he/she is the proper person to determine what level of assistance is allowed while meeting the learning/assessment goals of the assignment.  In cases like these, where you have doubt over the allowable scope for assistance, you need to speak to your professor for guidance.  Since you have already received assistance, this conversation will involve disclosure of previous assistance, so you should be open to the possibility that you may have to discard some of that work.

The other issue here is the importance of learning how things work.  If you have been provided with code by an outside professional that solves some problem in your assignment, then you need to take the time to understand how and why that code solves the problem.  You say that if you are asked to remove the code then that will put you back to a point where you can't solve the problem.  This suggests to me that you don't actually understand what that code is doing, and so it is not appropriate for you to use it in your assignment.  The best approach here would be to take the time to learn the reasoning behind the code that was used, and why it works to solve your problem.  Once you understand this, it should not be a major problem if you had to remove that code and write your own replacement code in a different form.