Project tutorial
LED Indicator for Your Robot / Machine

LED Indicator for Your Robot / Machine © GPL3+

This little project is just for the beginners showing them how to link buttons to LEDs to control their state.

  • 33 views
  • 2 comments
  • 2 respects

Components and supplies

About this project

I am a learner in Arduino and electronics and I struggled to write the code and connect everything up even though it being very simple. So, I have decided to upload this project the first part to my CNC machine I am eventually going to create just to show you the stages and to show you how the parts come together.

Code

Button Activation CodeArduino
The system has a go button a stop button and a reset button when the go button is clicked the green led is on showing that it is operational when the stop button is pressed the led goes off displaying a red led to show it has stopped and the rest button kills everything
const int LED_GREEN = 13;       //Giving Pin 13 the name of LED_GREEN
const int BTN_GO = 2;        //Giving Pin 2 the name of BTN_ON
const int LED_RED = 12;       //Giving Pin 12 the name of LED_RED
const int BTN_STOP = 4;      //Giving Pin 4 the name of BTN_OFF
const int BTN_RESET = 7;
int btn_state1 = 0;       //Declaring the Button State variable 
int btn_state2 = 0;
int btn_state3 =0;
void setup() {
  // put your setup code here, to run once:
  pinMode(LED_GREEN, OUTPUT);      //Setting Pin 13 as an OUTPUT
  pinMode(BTN_GO, INPUT);       //Setting Pin 2 as an INPUT
  pinMode(LED_RED, OUTPUT);       //Setting Pin 12 as an OUTPUT
  pinMode(BTN_STOP, INPUT);
  pinMode(BTN_RESET, INPUT);
  digitalWrite(BTN_GO, HIGH);
  digitalWrite(BTN_STOP, HIGH);
  digitalWrite(BTN_RESET, HIGH);
}

void loop() {
  // put your main code here, to run repeatedly:
  btn_state1 = digitalRead(BTN_GO);
  btn_state2 = digitalRead(BTN_STOP);
  btn_state3 = digitalRead(BTN_RESET);
  
  //Once button has been pressed LED stays ON
  if (btn_state1 == LOW)
  {
    digitalWrite(LED_GREEN, HIGH);
    digitalWrite(LED_RED, LOW);
  } 
  if (btn_state2 == LOW){
    digitalWrite(LED_GREEN, LOW);
    digitalWrite(LED_RED, HIGH);
  }
  if (btn_state3 == LOW)
  {
    digitalWrite(LED_GREEN, LOW);
    digitalWrite(LED_RED, LOW);
  }
}

Schematics

BreadBoard Plans
Shows you exactly how to connect up the parts (Easy to understand)
Led notificationplan bb zyodbmkbkg
Schematics
If you understand how to read this then i have also included the schematic for you
Led notificationplan schem 5e2rshidyy

Comments

Similar projects you might like

LED Display with Arduino ADC and PWM

Project tutorial by Ian Etheridge

  • 732 views
  • 0 comments
  • 6 respects

Plant Moisture Monitoring and Watering with LED Indicator

Project showcase by Rich Noordam

  • 4,108 views
  • 0 comments
  • 12 respects

MeArm Robot Arm - Your Robot - V1.0

Project tutorial by Benjamin Gray

  • 19,313 views
  • 3 comments
  • 35 respects

Bluetooth control led with lcd led status display real time.

Project tutorial by Youssef Sabaa

  • 17,326 views
  • 4 comments
  • 34 respects

LED Emergency Lights using WS2812 RGB LED Module

Project tutorial by bigboystoys13

  • 10,013 views
  • 5 comments
  • 20 respects
Add projectSign up / Login