Question: Can you help me fix my code! When the * is pressed, the code is suppposed to go into set mode. And during set mode,
Can you help me fix my code! When the is pressed, the code is suppposed to go into set mode. And during set mode, the hour, minute, second, ampm and temp are to be updated. I need the coding solutions to my code not explaining to me what I need to do Im using a nucleo board, x LCD, potentiometer, and LM temp sensor My code is below!
#include
#include
#include "mbed.h
#include "TextLCD.h
Define the keypad layout
char keymap
Ast row
Bnd row
Crd row
#Dth row
;
Define the GPIO pins connected to the keypad
#define ROWPIN PA
#define ROWPIN PA
#define ROWPIN PB
#define ROWPIN PC
#define COLPIN PA
#define COLPIN PA
#define COLPIN PB
#define COLPIN PB
Define the GPIO pins connected to the LCD
#define RSPIN PB
#define EPIN PB
#define DPIN PC
#define DPIN PB
#define DPIN PA
#define DPIN PA
Function prototypes
void initializegpio;
void setrowint row;
void resetrows;
char keypadscan;
int colscan;
void updatetimelcd;
void setmode;
void updatetemperaturelcd;
Global variables for GPIO pins
DigitalOut ROWROWPIN;
DigitalOut ROWROWPIN;
DigitalOut ROWROWPIN;
DigitalOut ROWROWPIN;
DigitalIn COLCOLPIN, PullUp;
DigitalIn COLCOLPIN, PullUp;
DigitalIn COLCOLPIN, PullUp;
DigitalIn COLCOLPIN, PullUp;
TextLCD lcdRSPIN, EPIN, DPIN, DPIN, DPIN, DPIN;
int main
initializegpio;
std::string sequence;
while true
char key keypadscan;
sequence key;
std::cout sequence;
if key
setmode; Enter Set Mode when is pressed
return ;
void initializegpio
ROW ROW ROW ROW;
void setrowint row
switch row
case :
ROW; ROW; ROW; ROW;
break;
case :
ROW; ROW; ROW; ROW;
break;
case :
ROW; ROW; ROW; ROW;
break;
case :
ROW; ROW; ROW; ROW;
break;
void resetrows
ROW ROW ROW ROW;
char keypadscan
char keypressed ;
for int row ; row ; row
setrowrow;
int col colscan;
if col
keypressed keymaprowcol;
break;
resetrows;
return keypressed;
int colscan
if COL return ;
if COL return ;
if COL return ;
if COL return ;
return ;
void updatetimelcd
void setmode
Prompt user to set hour
lcd.cls;
lcd.printfHOUR;
int hour ;
while true
char key keypadscan;
if key && key
hour hour key ;
lcd.printfd hour;
else if key #
if hour && hour
break;
else
lcd.cls;
lcd.printfERROR;
lcd.cls;
lcd.printfHOUR;
hour ;
Prompt user to set minute
lcd.cls;
lcd.printfMIN;
int minute ;
while true
char key keypadscan;
if key && key
minute minute key ;
lcd.printfd minute;
else if key #
if minute && minute
break;
else
lcd.cls;
lcd.printfERROR;
lcd.cls;
lcd.printfMIN;
minute ;
Prompt user to set seconds
lcd.cls;
lcd.printfSEC;
int second ;
while true
char key keypadscan;
if key && key
second second key ;
lcd.printfd second;
else if key #
if second && second
break;
else
lcd.cls;
lcd.printfERROR;
lcd.cls;
lcd.printfSEC;
second ;
Prompt user to set temperature
lcd.cls;
lcd.printfTEMP;
float temperature f;
while true
char key keypadscan;
if key && key
temperature tempera
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
