Wednesday, November 25, 2015

How to make Basic Arduino Beginning Circuit-Robomart

The step wise process to make basic Arduino beginning Circuit
This is going to be a basic circuit with 1 switch and 2 LEDs. We are using Arduino UNO for making this project. When nothing is pressed the red light will stay on when the button is pressed then the led will switch to the green one will turn on, this is what the circuit will perform.
Step 1: Requirements



Step 2: How to Set-Up The Circuit


Here we are not allowed to draw full power for LEDs , as we are using 2x1K resistors 9, 10 and 11 of the pin 3 output pins are used . Conflict is a drop down and a 10k resistor . You can set up your circuit for rail power and one for ground to see exactly how to setup remember
Step 3: How to Program The Arduino
The red button is programmed to the low and high setting will lead to the green were pressed together , the loop will run . To reduce the high green and red is set or not .
Source code:
int GreenLed = 11;
int RedLed = 9;
int SwitchPin = 10;

void setup()
{
  pinMode(GreenLed, OUTPUT);
  pinMode(RedLed, OUTPUT);
  pinMode(SwitchPin,INPUT);

}

void loop()
{
  if(digitalRead(SwitchPin) == HIGH)
  {
    digitalWrite(RedLed,LOW);
    digitalWrite(GreenLed, HIGH);
  }
  else
  {
    digitalWrite(GreenLed,LOW);
    digitalWrite(RedLed, HIGH);
  }
}
Step 4: Our Result

When you push the button and the green LED turns on when you release the red LED turns off. Have fun with this basic piece of code. Implement this in projects of your own, If you find it interesting enough, you are free to edit it and use in your work.. Feel free to comment and give suggestions in the comments section below.

No comments:

Post a Comment