Electrical question installing light where ceiling fan was
I turned the breaker off to my sportsroom and then removed a ceiling fan disconnected wiring black\black, white\white, green\green and blue\blue (the blue wire from the ceiling box was attached to a red wire from the ceiling). The light switch was in the OFF position. The light fixture I am hooking up has 2 black wires and a green wire. I know that 2 green grounds go together and that I will put one of two fixture wires with a black and the other with the white from the ceiling, but what do I do with the red wire? I initially just capped it and did black\black and black\white, when I flipped the breaker back on the light came ON even though the switch is still OFF, meaning the switch was not controlling the fixture. Please help me fix this, I am unsure what to do with the red wire. Thanks,
Electrically Challenged.