0

I've written up this very simply code to control transistors in an inverter circuit. The editor is flagging up errors which I can't see myself. I'm pretty new to Arduino programming but it's very simple code and can't see why it's being shown as having errors.

At first glance, what am I missing? I've pasted a section below:

int Phase1pos = 13;
int Phase2pos = 12;
int Phase3pos = 11;
int Phase1neg = 10;
int Phase2neg = 9;
int Phase3neg = 8;

void setup() {
pinMode(Phase1pos, OUTPUT);
pinMode(Phase2pos, OUTPUT);
pinMode(Phase3pos, OUTPUT);
pinMode(Phase1neg, OUTPUT);
pinMode(Phase2neg, OUTPUT);
pinMode(Phase3neg, OUTPUT);
}

void loop() {
    delayMicroseconds(16);
    digitalWrite(Phase3neg, HIGH);
    delayMicroseconds(27);
    digitalWrite(Phase2pos, HIGH);
    delayMicroseconds(138);
    digitalWrite(Phase1pos, HIGH);
    delayMicroseconds(54);
    digitalWrite(Phase1pos, LOW);
    delayMicroseconds(138);
    digitalWrite(Phase2pos, LOW);
    delayMicroseconds(27);
    digitalWrite(Phase3neg, LOW);
    delayMicroseconds(16);

    delayMicroseconds(7);
    digitalWrite(Phase3neg, HIGH);
    delayMicroseconds(54);
    digitalWrite(Phase2pos, HIGH);
    delayMicroseconds(93);
    digitalWrite(Phase1pos, HIGH);
    delayMicroseconds(108);
    digitalWrite(Phase1pos, LOW);
    delayMicroseconds(93);
    digitalWrite(Phase2pos, LOW);
    delayMicroseconds(54);
    digitalWrite(Phase3neg, LOW);
    delayMicroseconds(7);

    delayMicroseconds(2);
    digitalWrite(Phase3neg, HIGH);
    delayMicroseconds(80);
    digitalWrite(Phase2pos, HIGH);
    delayMicroseconds(47);
    digitalWrite(Phase1pos, HIGH);
    delayMicroseconds(159);
    digitalWrite(Phase1pos, LOW);
    delayMicroseconds(47);
    digitalWrite(Phase2pos, LOW);
    delayMicroseconds(80);
    digitalWrite(Phase3neg, LOW);
    delayMicroseconds(2);

    digitalWrite(Phase3neg, HIGH);
    delayMicroseconds(104);
    digitalWrite(Phase2pos, HIGH);
    digitalWrite(Phase1pos, HIGH);
    delayMicroseconds(208);
    digitalWrite(Phase1pos, LOW);
    digitalWrite(Phase2pos, LOW);
    delayMicroseconds(104);
    digitalWrite(Phase3neg, LOW);

    delayMicroseconds(2);
    digitalWrite(Phase3neg, HIGH);
    delayMicroseconds(80);
    digitalWrite(Phase1pos, HIGH);
    delayMicroseconds(47);
    digitalWrite(Phase2pos, HIGH);
    delayMicroseconds(159);
    digitalWrite(Phase2pos, LOW);
    delayMicroseconds(47);
    digitalWrite(Phase1pos, LOW);
    delayMicroseconds(80);
    digitalWrite(Phase3neg, LOW);

    delayMicroseconds(7);
    digitalWrite(Phase3neg, HIGH);
    delayMicroseconds(54);
    digitalWrite(Phase1pos, HIGH);
    delayMicroseconds(93);
    digitalWrite(Phase2pos, HIGH);
    delayMicroseconds(108);
    digitalWrite(Phase2pos, LOW);
    delayMicroseconds(93);
    digitalWrite(Phase1pos, LOW);
    delayMicroseconds(54);
    digitalWrite(Phase3neg, LOW);
    delayMicroseconds(7);

    delayMicroseconds(16);
    digitalWrite(Phase3neg, HIGH);
    delayMicroseconds(27);
    digitalWrite(Phase1pos, HIGH);
    delayMicroseconds(138);
    digitalWrite(Phase2pos, HIGH);
    delayMicroseconds(54);
    digitalWrite(Phase2pos, LOW);
    delayMicroseconds(138);
    digitalWrite(Phase1pos, LOW);
    delayMicroseconds(27);
    digitalWrite(Phase3neg, LOW);
    digitalWrite(16);

    delayMicroseconds(28);
    digitalWrite(Phase3neg, HIGH);
    digitalWrite(Phase1pos, HIGH);
    delayMicroseconds(180);
    delayMicroseconds(180);
    digitalWrite(Phase1pos, LOW);
    digitalWrite(Phase3neg, LOW);
    delayMicroseconds(28);

    delayMicroseconds(16);
    digitalWrite(Phase1pos, HIGH);
    delayMicroseconds(27);
    digitalWrite(Phase3neg, HIGH);
    delayMicroseconds(138);
    digitalWrite(Phase2neg, HIGH);
    delayMicroseconds(54);
    digitalWrite(Phase2neg, LOW);
    delayMicroseconds(138);
    digitalWrite(Phase3neg, LOW);
    delayMicroseconds(27);
    digitalWrite(Phase1pos, LOW);
    delayMicroseconds(16);

    delayMicroseconds(7);
    digitalWrite(Phase1pos, HIGH);
    delayMicroseconds(54);
    digitalWrite(Phase3neg, HIGH);
    delayMicroseconds(93);
    digitalWrite(Phase2neg, HIGH);
    delayMicroseconds(108);
    digitalWrite(Phase2neg, LOW);
    delayMicroseconds(93);
    digitalWrite(Phase3neg, LOW);
    delayMicroseconds(54);
    digitalWrite(Phase1pos, LOW);

    delayMicroseconds(2);
    digitalWrite(Phase1pos, HIGH);
    delayMicroseconds(80);
    digitalWrite(Phase3neg, HIGH);
    delayMicroseconds(47);
    digitalWrite(Phase2neg, HIGH);
    delayMicroseconds(159);
    digitalWrite(Phase2neg, LOW);
    delayMicroseconds(47);
    digitalWrite(Phase3neg, LOW);
    delayMicroseconds(80);
    digitalWrite(Phase1pos, LOW);
    delayMicroseconds(2);

    digitalWrite(Phase1pos, HIGH);
    delayMicroseconds(104);
    digitalWrite(Phase2neg, HIGH);
    digitalWrite(Phase3neg, HIGH);
    delayMicroseconds(208);
    digitalWrite(Phase3neg, LOW);
    digitalWrite(Phase2neg, LOW);
    delayMicroseconds(104);
    digitalWrite(Phase1pos, LOW);

    delayMicroseconds(2);
    digitalWrite(Phase1pos, HIGH);
    delayMicroseconds(80);
    digitalWrite(Phase2neg, HIGH);
    delayMicroseconds(47);
    digitalWrite(Phase3neg, HIGH);
    delayMicroseconds(159);
    digitalWrite(Phase3neg, LOW);
    delayMicroseconds(47);
    digitalWrite(Phase2neg, LOW);
    delayMicroseconds(80);
    digitalWrite(Phase1pos, LOW);
    delayMicroseconds(2);

    delayMicroseconds(7);
    digitalWrite(Phase1pos, HIGH);
    delayMicroseconds(54);
    digitalWrite(Phase2neg, HIGH);
    delayMicroseconds(93);
    digitalWrite(Phase3neg, HIGH);
    delayMicroseconds(108);
    digitalWrite(Phase3neg, LOW);
    delayMicroseconds(93);
    digitalWrite(Phase2neg, LOW);
    delayMicroseconds(54);
    digitalWrite(Phase1pos, LOW);
    delayMicroseconds(7);

    delayMicroseconds(16);
    digitalWrite(Phase1pos, HIGH);
    delayMicroseconds(27);
    digitalWrite(Phase2neg, HIGH);
    delayMicroseconds(138);
    digitalWrite(Phase3neg, HIGH);
    delayMicroseconds(54);
    digitalWrite(Phase3neg, LOW);
    delayMicroseconds(138);
    digitalWrite(Phase2neg, LOW);
    delayMicroseconds(27);
    digitalWrite(Phase1pos, LOW);
    delayMicroseconds(16);

    delayMicroseconds(28);
    digitalWrite(Phase1pos, HIGH);
    digitalWrite(Phase2neg, HIGH);
    delayMicroseconds(180);
    delayMicroseconds(180);
    digitalWrite(Phase2neg, LOW);
    digitalWrite(Phase1pos, LOW);
    delayMicroseconds(28);

    delayMicroseconds(16);
    digitalWrite(Phase2neg, HIGH);
    delayMicroseconds(27);
    digitalWrite(Phase1pos, HIGH);
    delayMicroseconds(138);
    digitalWrite(Phase3pos, HIGH);
    delayMicroseconds(54);
    digitalWrite(Phase3pos, LOW);
    delayMicroseconds(138);
    digitalWrite(Phase1pos, LOW);
    delayMicroseconds(27);
    digitalWrite(Phase2neg, LOW);
    delayMicroseconds(16);

    delayMicroseconds(7);
    digitalWrite(Phase2neg, HIGH);
    delayMicroseconds(54);
    digitalWrite(Phase1pos, HIGH);
    delayMicroseconds(93);
    digitalWrite(Phase3pos, HIGH);
    delayMicroseconds(108);
    digitalWrite(Phase2pos, LOW);
    delayMicroseconds(93);
    digitalWrite(Phase1pos, LOW);
    delayMicroseconds(54);
    digitalWrite(Phase2neg, LOW);
    delayMicroseconds(7);

    delayMicroseconds(2);
    digitalWrite(Phase2neg, HIGH);
    delayMicroseconds(80);
    digitalWrite(Phase1pos, HIGH);
    delayMicroseconds(47);
    digitalWrite(Phase3pos, HIGH);
    delayMicroseconds(159);
    digitalWrite(Phase3pos, LOW);
    delayMicroseconds(47);
    digitalWrite(Phase1pos, LOW);
    delayMicroseconds(80);
    digitalWrite(Phase2neg, LOW);
    delayMicroseconds(2);

    digitalWrite(Phase2neg, HIGH);
    delayMicroseconds(104);
    digitalWrite(Phase1pos, HIGH);
    digitalWrite(Phase3pos, HIGH);
    delayMicroseconds(208);
    digitalWrite(Phase3pos, LOW);
    digitalWrite(Phase1pos, LOW);
    delayMicroseconds(104);
    digitalWrite(Phase2neg, LOW);

    delayMicroseconds(2);
    digitalWrite(Phase2neg, HIGH);
    delayMicroseconds(80);
    digitalWrite(Phase3pos, HIGH);
    delayMicroseconds(47);
    digitalWrite(Phase1pos, HIGH);
    delayMicroseconds(159);
    digitalWrite(Phase1pos, LOW);
    delayMicroseconds(47);
    digitalWrite(Phase3pos, LOW);
    delayMicroseconds(80);
    digitalWrite(Phase2neg, LOW);
    delayMicroseconds(2);

    delayMicroseconds(7);
    digitalWrite(Phase2neg, HIGH);
    delayMicroseconds(54);
    digitalWrite(Phase3pos, HIGH);
    delayMicroseconds(93);
    digitalWrite(Phase1pos, HIGH);
    delayMicroseconds(108);
    digitalWrite(Phase1pos, LOW);
    delayMicroseconds(93);
    digitalWrite(Phase3pos, LOW);
    delayMicroseconds(54);
    digitalWrite(Phase2neg, LOW);
    delayMicroseconds(7);

    delayMicroseconds(16);
    digitalWrite(Phase2neg, HIGH);
    delayMicroseconds(27);
    digitalWrite(Phase3pos, HIGH);
    delayMicroseconds(138);
    digitalWrite(Phase1pos, HIGH);
    delayMicroseconds(54);
    digitalWrite(Phase1pos, LOW);
    delayMicroseconds(138);
    digitalWrite(Phase3pos, LOW);
    delayMicroseconds(27);
    digitalWrite(Phase2neg, LOW);
    delayMicroseconds(16);

    delayMicroseconds(28);
    digitalWrite(Phase2neg, HIGH);
    digitalWrite(Phase3pos, HIGH);
    delayMicroseconds(180);
    delayMicroseconds(180);
    digitalWrite(Phase3pos, LOW);
    digitalWrite(Phase2neg, LOW);
    delayMicroseconds(28);

    delayMicroseconds(16);
    digitalWrite(Phase3pos, HIGH);
    delayMicroseconds(27);
    digitalWrite(Phase2neg, HIGH);
    delayMicroseconds(138);
    digitalWrite(Phase1neg, HIGH);
    delayMicroseconds(54);
    digitalWrite(Phase1neg, LOW);
    delayMicroseconds(138);
    digitalWrite(Phase2neg, LOW);
    delayMicroseconds(27);
    digitalWrite(Phase3pos, LOW);
    delayMicroseconds(16);

    delayMicroseconds(7);
    digitalWrite(Phase3pos, HIGH);
    delayMicroseconds(54);
    digitalWrite(Phase2neg, HIGH);
    delayMicroseconds(93);
    digitalWrite(Phase1neg, HIGH);
    delayMicroseconds(108);
    digitalWrite(Phase1neg, LOW);
    delayMicroseconds(93);
    digitalWrite(Phase2neg, LOW);
    delayMicroseconds(54);
    digitalWrite(Phase3pos, LOW);
    delayMicroseconds(7);

    delayMicroseconds(2);
    digitalWrite(Phase3pos, HIGH);
    delayMicroseconds(80);
    digitalWrite(Phase2neg, HIGH);
    delayMicroseconds(47);
    digitalWrite(Phase1neg, HIGH);
    delayMicroseconds(159);
    digitalWrite(Phase1neg, LOW);
    delayMicroseconds(47);
    digitalWrite(Phase2neg, LOW);
    delayMicroseconds(80);
    digitalWrite(Phase3pos, LOW);
    delayMicroseconds(2);

    digitalWrite(Phase3pos, HIGH);
    delayMicroseconds(104);
    digitalWrite(Phase1neg, HIGH);
    digitalWrite(Phase2neg, HIGH);
    delayMicroseconds(208);
    digitalWrite(Phase2neg, LOW);
    digitalWrite(Phase1neg, LOW);
    delayMicroseconds(104);
    digitalWrite(Phase3pos, LOW);

    delayMicroseconds(2);
    digitalWrite(Phase3pos, HIGH);
    delayMicroseconds(80);
    digitalWrite(Phase1neg, HIGH);
    delayMicroseconds(47);
    digitalWrite(Phase2neg, HIGH);
    delayMicroseconds(159);
    digitalWrite(Phase2neg, LOW);
    delayMicroseconds(47);
    digitalWrite(Phase1neg, LOW);
    delayMicroseconds(80);
    digitalWrite(Phase3pos, LOW);
    delayMicroseconds(2);

    delayMicroseconds(7);
    digitalWrite(Phase3pos, HIGH);
    delayMicroseconds(54);
    digitalWrite(Phase1neg, HIGH);
    delayMicroseconds(93);
    digitalWrite(Phase2neg, HIGH);
    delayMicroseconds(108);
    digitalWrite(Phase2neg, LOW);
    delayMicroseconds(93);
    digitalWrite(Phase1neg, LOW);
    delayMicroseconds(54);
    digitalWrite(Phase3pos, LOW);
    delayMicroseconds(7);

    delayMicroseconds(16);
    digitalWrite(Phase3pos, HIGH);
    delayMicroseconds(27);
    digitalWrite(Phase1neg, HIGH);
    delayMicroseconds(138);
    digitalWrite(Phase2neg, HIGH);
    delayMicroseconds(54);
    digitalWrite(Phase2neg, LOW);
    delayMicroseconds(138);
    digitalWrite(Phase2neg, LOW);
    delayMicroseconds(27);
    digitalWrite(Phase3pos, LOW);
    delayMicroseconds(16);

    delayMicroseconds(28);
    digitalWrite(Phase1neg, HIGH);
    digitalWrite(Phase3pos, HIGH);
    delayMicroseconds(180);
    delayMicroseconds(180);
    digitalWrite(Phase3pos, LOW);
    digitalWrite(Phase1neg, LOW);
    delayMicroseconds(28);

    delayMicroseconds(16);
    digitalWrite(Phase1neg, HIGH);
    delayMicroseconds(27);
    digitalWrite(Phase3pos, HIGH);
    delayMicroseconds(138);
    digitalWrite(Phase2pos, HIGH);
    delayMicroseconds(54);
    digitalWrite(Phase2pos, LOW);
    delayMicroseconds(138);
    digitalWrite(Phase3pos, LOW);
    delayMicroseconds(27);
    digitalWrite(Phase1neg, LOW);
    delayMicroseconds(16);

    delayMicroseconds(7);
    digitalWrite(Phase1neg, HIGH);
    delayMicroseconds(54);
    digitalWrite(Phase3pos, HIGH);
    delayMicroseconds(93);
    digitalWrite(Phase2pos, HIGH);
    delayMicroseconds(108);
    digitalWrite(Phase2pos, LOW);
    delayMicroseconds(93);
    digitalWrite(Phase2pos, LOW);
    delayMicroseconds(54);
    digitalWrite(Phase1neg, LOW);
    delayMicroseconds(7);

    delayMicroseconds(2);
    digitalWrite(Phase1neg, HIGH);
    delayMicroseconds(80);
    digitalWrite(Phase3pos, HIGH);
    delayMicroseconds(47);
    digitalWrite(Phase2pos, HIGH);
    delayMicroseconds(159);
    digitalWrite(Phase2pos, LOW);
    delayMicroseconds(47);
    digitalWrite(Phase3pos, LOW);
    delayMicroseconds(80);
    digitalWrite(Phase1neg, LOW);
    delayMicroseconds(2);

    digitalWrite(Phase1neg, HIGH);
    delayMicroseconds(104);
    digitalWrite(Phase2pos, HIGH);
    digitalWrite(Phase3pos, HIGH);
    delayMicroseconds(208);
    digitalWrite(Phase3pos, LOW);
    digitalWrite(Phase2pos, LOW);
    delayMicroseconds(104);
    digitalWrite(Phase1neg, LOW);

    delayMicroseconds(2);
    digitalWrite(Phase1neg, HIGH);
    delayMicroseconds(80);
    digitalWrite(Phase2pos, HIGH);
    delayMicroseconds(47);
    digitalWrite(Phase3pos, HIGH);
    delayMicroseconds(159);
    digitalWrite(Phase3pos, LOW);
    delayMicroseconds(47);
    digitalWrite(Phase2pos, LOW);
    delayMicroseconds(80);
    digitalWrite(Phase2neg, LOW);
    delayMicroseconds(2);

    delayMicroseconds(7);
    digitalWrite(Phase1neg, HIGH);
    delayMicroseconds(54);
    digitalWrite(Phase2pos, HIGH);
    delayMicroseconds(93);
    digitalWrite(Phase3pos, HIGH);
    delayMicroseconds(108);
    digitalWrite(Phase3pos, LOW);
    delayMicroseconds(93);
    digitalWrite(Phase2pos, LOW);
    delayMicroseconds(54);
    digitalWrite(Phase1neg, LOW);
    delayMicroseconds(7);

    delayMicroseconds(16);
    digitalWrite(Phase1neg, HIGH);
    delayMicroseconds(27);
    digitalWrite(Phase2pos, HIGH);
    delayMicroseconds(138);
    digitalWrite(Phase3pos, HIGH);
    delayMicroseconds(54);
    digitalWrite(Phase3pos, LOW);
    delayMicroseconds(138);
    digitalWrite(Phase2pos, LOW);
    delayMicroseconds(27);
    digitalWrite(Phase1neg, LOW);
    delayMicroseconds(16);

    delayMicroseconds(28);
    digitalWrite(Phase1neg, HIGH);
    digitalWrite(Phase2pos, HIGH);
    delayMicroseconds(180);
    delayMicroseconds(180);
    digitalWrite(Phase2pos, LOW);
    digitalWrite(Phase1neg, LOW);
    delayMicroseconds(28);

    delayMicroseconds(16);
    digitalWrite(Phase2pos, HIGH);
    delayMicroseconds(27);
    digitalWrite(Phase1neg, HIGH);
    delayMicroseconds(138);
    digitalWrite(Phase3neg, HIGH);
    delayMicroseconds(54);
    digitalWrite(Phase3neg, LOW);
    delayMicroseconds(138);
    digitalWrite(Phase1neg, LOW);
    delayMicroseconds(27);
    digitalWrite(Phase2pos, LOW);
    delayMicroseconds(16);
}
4
  • 2
    Welcome to Arduino SE. It would be helpful if you could post the error messages that you're getting. Commented Feb 18, 2015 at 0:00
  • Hi, thanks! In function 'void loop()': 99: error: too few arguments to function 'void digitalWrite(uint8_t, uint8_t)' 109: error: at this point in file
    – Chris
    Commented Feb 18, 2015 at 0:01
  • I've found the one at line 109 but the one at 99 I can't seem to see
    – Chris
    Commented Feb 18, 2015 at 0:04
  • 1
    I copy/pasted it, fixed 109, it compiled... Commented Feb 18, 2015 at 12:01

1 Answer 1

5

Here's line 109:

 digitalWrite(16);

As the error message says, there aren't enough arguments. It looks like you meant to call delayMicroseconds() there instead of digitalWrite().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.