Were there black soldiers in the civil war?

Yes, on both sides.

When the Union armies liberated Southern slaves during their campaigns, they didn't know what to do with them, so they put them to work in the camps, performing fatigues that the white troops didn't want to do. Presently, white troops realised that enlisting black troops into the ranks would help their own chances of promotion, and eventually there were many black regiments, some of them serving in the front line.

The Confederates refused to put slaves into uniform until right at the end. But some free blacks did serve in the Southern armies, perhaps for the same reason as many of the poor white trash, who cared nothing about the slavery debate - just because they wanted to get into a darn good fight.