https://i.imgur.com/fpZlLgj.png (https://i.imgur.com/fpZlLgj.png)
Observers fire off two extremely quick signals, one when the powered rail turns one, one when it turns off.
The sticky piston will push the redstone block into the computer on the first signal, and pull it back on the second.
https://i.imgur.com/Ih5KjFy.png (https://i.imgur.com/Ih5KjFy.png)
Here's a simple loop that waits until a redstone current is detected on the back of the computer:
local function listen()
repeat
os.sleep(0.5)
local signal = redstone.getAnalogInput("back")
until signal > 0
print("Signal Received.")
os.sleep(5)
listen()
end
listen()
The first os.sleep is there to prevent a 'too long without yielding' error while the computer waits for input. The second one adds a delay before the computer will begin listening again, to prevent it from firing off multiple times after receiving a redstone signal. This setup assumes the powered rail will not stay activated once pressed, in theory you can add better safeguarding measures to your own program.