Hi guys,
My name is Esther and right now I’m doing my graduation assignment for the bachelor Industrial Product Design. For this assignment I’m developing a phone case with a keypad and screen for use in nursing homes. The only problem is that i never learned how to code during my programme. Thats why I’m asking you for help. I started a bit but I don’t know how to properly finish the code. I wil post the code below.
For this project I am using;
• Arduino Nano IOT 33
• OLED screen 128x64
• Membrame keypad 4x4
• 3x LED
My questions for the code are as follows:
• How do I make sure only 3 numbers are entered and not more
• How do I make sure that once 3 numbers are entered, and the user types more numbers the already entered numbers are overwritten? I’m not using a ‘clear’ button
• The fourth character will be a ‘A’ or a ‘B’. If there is a ‘A’ entered and the user presses ‘A’ again the letter should disappear. How would I do that?
• Lastly, when the user hits send the led thats on should blink for a few seconds and then turn off. I can remember something about defining the led that’s on as LedStatus.True but I don’t really know how to properly use it.
I know these are a lot of questions but I really need your help.
tips are always aprecciated
Kind regards,
Esther
//OLED
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// declare an SSD1306 display object connected to I2C
Adafruit_SSD1306 oled(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1)
// Led
int ledGreen = 13;
int ledYellow = 12;
int ledRed = 11;
//Keypad
#define ROWS 4
#define COLS 4
char keymap[numRows][numCols]=
{
{'1', '2', '3', 'G'},
{'4', '5', '6', 'O'},
{'7', '8', '9', 'R'},
{'A', '0', 'B', 'S'}
};
//Code that shows the the keypad connections to the arduino terminals
byte rowPins[numRows] = {9,8,7,6}; //Rows 0 to 3
byte colPins[numCols]= {5,4,3,2}; //Columns 0 to
void setup() {
// put your setup code here, to run once:
byte numDigits = 4;
}
void loop() {
// put your main code here, to run repeatedly:
case '0'... '9' /// invoer client nummer
{
char key = keypad.getKey();
if(key){
if(key=='*'){
keyNum = 0;
}
else{
if(keyNum<=999){
keyNum = (keyNum*10) + (int(key)-48);
}
case 'A''B' /// invoer extra kamer v mnr,mvr
case 'G': /// geen agitatie, Groen
digitalWrite(ledGreen, HIGH);
digitalWrite(ledYellow, LOW);
digitalWrite(ledRed, LOW);
case 'O': /// milde agitatie, Oranje
digitalWrite(ledGreen, LOW);
digitalWrite(ledYellow, HIGH);
digitalWrite(ledRed, LOW);
case 'R': /// heftige agitatie, Rood
digitalWrite(ledGreen, LOW);
digitalWrite(ledYellow, LOW);
digitalWrite(ledRed, HIGH);
case 'S': // verstuur invoer
