hello and thanks for help
int i = 5000;
i--:
how can I know the i value when digitalpin(X) is high or after 1 sec or if analogpin(X) is 200 etc
and use this value
thanks
hello and thanks for help
int i = 5000;
i--:
how can I know the i value when digitalpin(X) is high or after 1 sec or if analogpin(X) is 200 etc
and use this value
thanks
Looks like you need to do some basic C++ tutorials and read some documentation. Google will help you find these.
Everything you mentioned is very basic practices. Is this a late assignment?
Duplicate post. help with Variables - Programming Questions - Arduino Forum
Ok, we have ESL issues here, I suspect.
If you set 'i' to 5000, then increment it by 1, it's value will be 5001. How can you know this? The same way that if you put three apples in an empty bag, you know that there are three apples in there. This has nothing to do with reading any pins.
If your problem involves timing, then you need to work with the blink without delay sketch and understand it.
You also nee to think more clearly about sequences of events. you want to know if the pin is high after 1 second. 1 second from when? What if it goes high before then? What if it goes high before then, and then drops back to low at the one second mark?
To use the value, well - you digitalread it and, well, use it. When you use a thing, you use it to accomplish some purpose. I don't know how you would use the value unless I know what you want to do with it.
Also read this: http://xyproblem.info/.
khaldoon, please post all of your code.
aarg:
Duplicate post. help with Variables - Programming Questions - Arduino Forum
its not the same post
#define triacPulse 9
volatile int i=1000;
void setup() {
pinMode(2, INPUT);
pinMode(triacPulse, OUTPUT);
}
void loop() {
attachInterrupt(0, zero, RISING);
}
void zero(){
i--:
delayMicroseconds((i * 6) + 1000); 1
digitalWrite(triacPulse, HIGH);
delayMicroseconds(200);
digitalWrite(triacPulse, LOW);
}
when i is decreasing my analogread(0) is increasing (feedback sensor )
how can I know the i value at A0 = 200 or 400 etc....
sorry for the miss understanding
PaulMurrayCbr:
Ok, we have ESL issues here, I suspect.If you set 'i' to 5000, then increment it by 1, it's value will be 5001. How can you know this? The same way that if you put three apples in an empty bag, you know that there are three apples in there. This has nothing to do with reading any pins.
If your problem involves timing, then you need to work with the blink without delay sketch and understand it.
You also nee to think more clearly about sequences of events. you want to know if the pin is high after 1 second. 1 second from when? What if it goes high before then? What if it goes high before then, and then drops back to low at the one second mark?
To use the value, well - you digitalread it and, well, use it. When you use a thing, you use it to accomplish some purpose. I don't know how you would use the value unless I know what you want to do with it.
Also read this: http://xyproblem.info/.
sorry for my bad English I thought I can understand something in programming
and thanks for ur time