Pinguino + Input Shield

Pinguino+Arduino Input Shield
Pin: Pin Allocation: Example: LED display using analog and digital button Flow Chart: Program Code:
#define x 15
#define y 14
#define button_A 5
#define button_B 3
#define button_C 4

#define LED_TOP 24
#define LED_BOTTOM 22
#define LED_RIGHT 25
#define LED_LEFT 23
#define LED_A 26
#define LED_B 27
#define LED_C 28

void setup()
{
    int i;
    for(i=3;i<=5;i++)
    pinMode(i, INPUT);
    for(i=22;i<=28;i++)
    pinMode(i,OUTPUT);
}

void loop()
{
    int valx,valy;
    int i;

    while(1)
    {
		digitalWrite(LED_LEFT, LOW);
		digitalWrite(LED_RIGHT, LOW);
		digitalWrite(LED_BOTTOM, LOW);
		digitalWrite(LED_TOP, LOW);
		digitalWrite(LED_A,LOW);
		digitalWrite(LED_B,LOW);
		digitalWrite(LED_C,LOW);

		valx=analogRead(x); //Read Analog input
		if(valx>1000)
		digitalWrite(LED_LEFT, HIGH);
		else if(valx<20)
		digitalWrite(LED_RIGHT,HIGH);

		valy=analogRead(y);
		if(valy>1000)
		digitalWrite(LED_BOTTOM, HIGH);
		else if(valy<20)
		digitalWrite(LED_TOP,HIGH);

		if(digitalRead(button_A)==0)    //Check Button A
		digitalWrite(LED_A, HIGH);   // Set LED on

		else if(digitalRead(button_B)==0)   //Check Button B
		digitalWrite(LED_B, HIGH);    // Set LED Off

		else if(digitalRead(button_C)==0)   //Check Button C
		digitalWrite(LED_C, HIGH);    // Set LED off

    }
}
Demonstration:

BUY

Leave a Comment

Your email address will not be published.

Share this Tutorial

Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest
Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest

Latest Tutorail

Control Servo With Gesture Using ESP32 and Arduino
Send Sensor’s Data to ThingSpeak Using ESP32
Basic Usage of iMAX B6AC LiPo Charger
Colourful Bed Lamp Using Tilt Sensor on Maker UNO
Dot Matrix Clock With NTP Server Using ESP32
Scroll to Top