Answered step by step
Verified Expert Solution
Question
1 Approved Answer
hey just need some one to look at this code its supposed to have am and pm in the clock section but cant get it
hey just need some one to look at this code its supposed to have am and pm in the clock section but cant get it to work and i want it to read the numbers with a before them while its in single digits
#include
LiquidCrystal lcd;
int ampm;
int hours;
int minutes;
int seconds;
int disphours;
int rawval;
float scaledtemp;
int pm;
int am;
void setup
pinModeA INPUT;
pinModeA INPUT;
pinModeA INPUT;
pinModeA INPUT;
lcd.begin;
Serial.begin;
pm pm;
hours ;
minutes ;
seconds ;
disphours ;
void loop
int reading analogReadA; read value returned by temperature sensor at analog input A
float voltage reading ; converting that reading to voltage
voltage ;
float temperatureC voltage ; converting from mv per degree wit mV offset to degrees voltage mV times
lcd.clear;
lcd.setCursor;
lcd.printTime:;
lcd.setCursor;
lcd.print:;
lcd.setCursor;
lcd.print:;
lcd.setCursor;
lcd.printdisphours;
lcd.setCursor;
lcd.printminutes;
lcd.setCursor;
lcd.printseconds;
if hours
lcd.setCursor;
lcd.printAM;
lcd.setCursor;
lcd.printTemp: ;
lcd.printtemperatureC;
lcd.printC;
delay;
bool calhrs;
bool calmin;
int disphours;
int rawanalogue;
calhrs digitalReadA;
calmin digitalReadA;
ifcalhrs
rawanalogue analogReadA;
hours scaleanaloguerawanalogue, ;
seconds ;
delay;
else ifcalmin
rawanalogue analogReadA;
minutes scaleanaloguerawanalogue, ;
seconds ;
delay;
else
seconds ;
ifseconds
minutes ;
seconds ;
ifminutes
hours ;
minutes ;
ifhours
hours ;
delay;
disphours hours;
ampm ;
ifhours
disphours hours ;
ampm ;
float scaleanalogueint rawvalue, float gradient, float intercept
float voltage;
voltage rawvalue ;
return voltageinterceptgradient;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started