2017/06/16

arduino_official_logo__

 

#include<Keyboard.h>

const int led1 = 5;
const int led2 = 4;
const int buttonX = 3;
const int buttonZ = 2;

void setup()
{
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(buttonX, INPUT);
pinMode(buttonZ, INPUT);

Keyboard.begin();
}

void loop()
{
if (digitalRead(buttonX) == LOW)
{
Keyboard.press(‘x’);
digitalWrite(led1, HIGH);
}

else //Otherwise,
{
Keyboard.release(‘x’);
digitalWrite(led1, LOW);
}

if (digitalRead(buttonZ) == LOW)
{
Keyboard.press(‘z’);
digitalWrite(led2, HIGH);
}

else //Otherwise,
{
Keyboard.release(‘z’);
digitalWrite(led2, LOW);
}
}

 

This is the edited version of the code now lincluding led’s

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s