I have an arduino mega board and I used an op-amp as a zero crossing detector, the signal generated by the op-amp is then injected into a digital pin to read it, but unfortunately the signal has dropped to a small value.
What I want is to read the signal from the op-amp then after some time"using delay command " I get a pulse.
By the way, I used a pull down and Pull up resistors.
It seems you didn't read the link in #2 (or you would have known how to post code properly - i.e. use code tags around it - and please format it properly, do CTRL-T in the IDE), and you also didn't post the circuit diagram as requested, without which it's pretty hard to see what's going on.
but unfortunately the signal has dropped to a small value.
How do you know that? i.e. Do you have an oscilloscope? ...That 5mS pulse could measure very-low on a multimeter, especially if it's followed by a 500mS delay.
Are you seeing any indication of any switching on the serial monitor? (BTW - The serial.print statements take-up time and could possibly mess-up your timing.)
Your code should be enclosed in code tags which you can get by clicking the menu icon that looks like this: </>
Then your code will look like this:
int pi=30;
int po=26;
void setup() {
Serial.begin(9600);
pinMode(pi,INPUT);
pinMode(po,OUTPUT); .....
Re: firing angle control for an SCR
Angle relative to what? ...That 500mS delay is awfully long relative to 50/60Hz line frequency. And, if we're talking about power line voltage it needs to be electrically isolated (optically with a transformer) from the Arduino on both the phase-sensing input and the SCR-controlled output. And, an SCR only conducts in one direction so it only works on half of the AC waveform. (Light dimmers & motor speed controllers usually use TRIACs.)