0% found this document useful (0 votes)
29 views2 pages

Code Keypad 3x4

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views2 pages

Code Keypad 3x4

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Code keypad 3x4

int sensorPin = A0; // select the input pin for the potentiometer

//int ledPin = 13; // select the pin for the LED

int sensorValue = 0; // variable to store the value coming from the sensor

int keyvalue;

void setup()

//pinMode(ledPin, OUTPUT); // declare the ledPin as an OUTPUT:

Serial.begin(9600);

Serial.println("Started. Press a key");

void loop()

{printlnkeyvalue(300);}

void printlnkeyvalue(int delay_time)


{

sensorValue = analogRead(sensorPin); // read the value from the sensor:

//digitalWrite(ledPin, HIGH); // turn the ledPin on

switch(sensorValue)

case 0 ... 100: keyvalue = 13; break; // noise

case 101 ... 132: keyvalue = -1; break; // *

case 133 ... 154: keyvalue = 0; break; // 0

case 155 ... 216: keyvalue = -2; break; // #

case 217 ... 281: keyvalue = 7; break; // 7

case 282 ... 318: keyvalue = 4; break; // 4

case 319 ... 349: keyvalue = 1; break; // 1

case 350 ... 390: keyvalue = 8; break; // 8

case 391 ... 463: keyvalue = 5; break; // 5

case 464 ... 519: keyvalue = 2; break; // 2

case 520 ... 619: keyvalue = 9; break; // 9

case 620 ... 848: keyvalue = 6; break; // 6

case 849 ... 1023: keyvalue = 3; break; // 3

if(keyvalue<13) { Serial.println(keyvalue); delay(delay_time); }

//digitalWrite(ledPin, LOW); // turn the ledPin off:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy