im trying to make it so a command block emits a redstone signal if a block is there. im trying to do this in Minecraft 1.12.2.
Read about the "testforblock" command: https://www.digminecraft.com/game_commands/testforblock_command.php
You can have the command block say
/testforblock <x> <y> <z> <block>
Heres an example:
/testforblock ~ ~-1 ~ diamond_ore
The /testforblock command works in 1.12.2
To have it continuously check, set it to repeat.
To detect when it has found the block, you can have a comparator running out from the command block.