EXPECTED INITIALIZER BEFORE 'IF'


hi. have been attempting basic if else else if coding , seem doing wrong. think might have analogpin or threshold not totally sure or how include them. thank you!

const int ledpin = 13;
void setup()
{
  pinmode(ledpin,output);
}
void loop()
if (ledpin = low)
{
  digitalwrite(ledpin,output);
}
else
{
  digitalwrite(ledpin,low);
}


arduino: 1.6.5 (mac os x), board: "arduino/genuino uno"

elseif:7: error: expected initializer before 'if'
elseif:11: error: expected unqualified-id before 'else'
expected initializer before 'if'

  report have more information with
  "show verbose output during compilation"
  enabled in file > preferences.

malformed loop function, no { }, = in place of == used. output in place of high should work, @ least bad style.

code: [select]
const int ledpin = 13;
void setup()
{
  pinmode(ledpin, output);
}
void loop() {
  if (ledpin == low)
  {
    digitalwrite(ledpin, high);
  }
  else
  {
    digitalwrite(ledpin, low);
  }
}


Arduino Forum > Using Arduino > Programming Questions > EXPECTED INITIALIZER BEFORE 'IF'


arduino

Comments