expected ';' before '{' token

Getting the following error: expected ';' before '{' token. Error is in line 3: for (int i=o;i {

1
2
3
4
5
6
7
8
void pulse() // output set of pulses
 {
 for (int i=0;i {
 digitalWrite(pulsepin, HIGH); // turn injector on
 delay(onTime);
 digitalWrite(pulsepin, LOW); // turn injector on
 delay(duration);
 }


Thank you for any help you may be able to provide. I am not familiar with code at all, just trying to run this on an Arduino.
Last edited on
I know you said you aren't familiar with code but for loops aren't too hard to understand at a basic level.

Read the for loop section of this carefully (pay close attention to the examples) and you should see the difference.
http://www.cplusplus.com/doc/tutorial/control/
James

Thanks for the reply. I've read the tutorial but everytime I try a fix, I just get another error (in the same line). Where does one go to find a freelancer who I can pay to fix this?

Thanks
This site has a Jobs forum. You might find someone there. Failing that, I guess you should look at recruitment agencies.
Your for loop is definitely incomplete, but I don't know how many times you wish to run the loop, so can't complete it. If it were only twice, for example, you would do this.
1
2
3
4
5
6
7
8
9
void pulse() // output set of pulses
 {
//run as long as i<2, increment i each time
 for (int i=0;i<2;i++) {
 digitalWrite(pulsepin, HIGH); // turn injector on
 delay(onTime);
 digitalWrite(pulsepin, LOW); // turn injector on
 delay(duration);
 }
Last edited on
Since for-loops uses semicolons to separate them, you need to add one after that integer "i" which didn't had it written properly and close it with ")".
Topic archived. No new replies allowed.