getting low output voltage after adding a resistor

my question is that, can I get the five volt output by only modifying the code?

or is it a dead end and I have to use the amp?