icon

Eye led push button for Arduino and Raspberry

projectImage
projectImage

Get this DFRobot Led button https://www.dfrobot.com/product-2351.html?tracking=61357a929f73e

 

Get a doll eye (0.8 x 0.6 inches aprox) https://amzn.to/3gUJrqp 

 

Download and print this part https://cults3d.com/en/3d-model/gadget/eye-led-push-button

 

projectImage
projectImage

Glue the doll eye to the push button

 

Fix the button to the case with 2 screws

projectImage

 

Connect push button red wire to Arduino or Raspberry 3.3 or 5v

Connect push button black wire to Arduino or Raspberry Pi GND

Connect green wire to any digital pin.

 

CODE
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(buttonPin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setwarnings(False)

buttonRead = GPIO.input(buttonPin)

 if (buttonRead == True):
    print('Eye button pressed')
CODE
void setup() {

  pinMode(2, INPUT_PULLUP);

}

void loop() {

  int sensorVal = digitalRead(2);

  Serial.println(sensorVal);


  if (sensorVal == HIGH) {

   // Eye button pressed

  }
}
projectImage
License
All Rights
Reserved
licensBg
0