what am i doing wrong


int button1 = 2;  // set button pin
int button2 = 3;  // set button pin
int button3 = 4;  // set button pin

void setup()
{
  pinmode(button1, input);  // set button input
  digitalwrite(button1, high);  // pull button high
  pinmode(button2, input);  // set button input
  digitalwrite(button2, high);  // pull button high
  pinmode(button3, input);  // set button input
  digitalwrite(button3, high);  // pull button high
 
}

void loop()
{
  if (digitalread(button1) == 0)  // if button goes low
  {
   keyboard.press(key_left_ctrl);
   keyboard.write('k');
   delay(1000);  // delay there aren't kajillion z's
   keyboard.release(key_left_ctrl);
   }
{
  if (digitalread(button2) == 0)  // if button goes low
  {
   keyboard.press(key_left_ctrl);
   keyboard.write('o');
   delay(1000);  // delay there aren't kajillion z's
   keyboard.release(key_left_ctrl);
  }
{
  if (digitalread(button3) == 0)  // if button goes low
  {
   keyboard.print('space');
   delay(1000);  // delay there aren't kajillion z's
  }

}

to people read code , should put inside code tags this

its button # on it


code: [select]

int button1 = 2;  // set button pin
int button2 = 3;  // set button pin
int button3 = 4;  // set button pin

void setup()
{
  pinmode(button1, input);  // set button input
  digitalwrite(button1, high);  // pull button high
  pinmode(button2, input);  // set button input
  digitalwrite(button2, high);  // pull button high
  pinmode(button3, input);  // set button input
  digitalwrite(button3, high);  // pull button high

}

void loop()
{
  if (digitalread(button1) == 0)  // if button goes low
  {
   keyboard.press(key_left_ctrl);
   keyboard.write('k');
   delay(1000);  // delay there aren't kajillion z's
   keyboard.release(key_left_ctrl);
   }
{
  if (digitalread(button2) == 0)  // if button goes low
  {
   keyboard.press(key_left_ctrl);
   keyboard.write('o');
   delay(1000);  // delay there aren't kajillion z's
   keyboard.release(key_left_ctrl);
  }
{
  if (digitalread(button3) == 0)  // if button goes low
  {
   keyboard.print('space');
   delay(1000);  // delay there aren't kajillion z's
  }
}
}


Arduino Forum > Using Arduino > Programming Questions > what am i doing wrong


arduino

Comments

Popular posts from this blog

opencv3, tbb and rasp pi 2 - Raspberry Pi Forums

small ethernet problem - Raspberry Pi Forums

Multithumb configuration params not working? - Joomla! Forum - community, help and support