Skip to main content
Post Closed as "Not suitable for this site" by CommunityBot, gre_gor, MatsK, KIIV, Juraj
added 5 characters in body
Source Link
dda
  • 1.6k
  • 1
  • 13
  • 18

I would like to create a compile error so sketch does not upload in certain cases.

I have wrotewritten a library with a function that adds pins being used to an array. If If the same pin is used twice I want to fail the compilingcompilation (preferably with an error that explains why). Is this possible?

void CheckPinNum(int newPinNum){
  for (int i=0; i <= PinArrayLength; i++){
    if (newPinNum == PinArray[i])
      failCompilation("You entered same pin twice!");
  }
}

I would like to create a compile error so sketch does not upload in certain cases.

I have wrote a library with a function that adds pins being used to an array. If same pin is used twice I want to fail the compiling (preferably with an error that explains why). Is this possible?

void CheckPinNum(int newPinNum){
  for (int i=0; i <= PinArrayLength; i++){
    if (newPinNum == PinArray[i])
      failCompilation("You entered same pin twice!");
  }
}

I would like to create a compile error so sketch does not upload in certain cases.

I have written a library with a function that adds pins being used to an array. If the same pin is used twice I want to fail the compilation (preferably with an error that explains why). Is this possible?

void CheckPinNum(int newPinNum){
  for (int i=0; i <= PinArrayLength; i++){
    if (newPinNum == PinArray[i])
      failCompilation("You entered same pin twice!");
  }
}
Source Link
bets
  • 141
  • 4

Purposely create compile error to fail the upload

I would like to create a compile error so sketch does not upload in certain cases.

I have wrote a library with a function that adds pins being used to an array. If same pin is used twice I want to fail the compiling (preferably with an error that explains why). Is this possible?

void CheckPinNum(int newPinNum){
  for (int i=0; i <= PinArrayLength; i++){
    if (newPinNum == PinArray[i])
      failCompilation("You entered same pin twice!");
  }
}