arduino not first choice programming stuff, i'm not expert @ it. print temperatureval lcd, , not display in decimal form, , displays without zeros (i.e. 9%, 20%, 100%, on).
is doable? thanks!
is doable? thanks!
code: [select]
#include <liquidcrystal.h>
// declare , set pin names
int temperatureadc = 0; // analog pin 0: analog voltage controlled temperature probe
int lcdbacklight = 3; //digital pin 3: lcd backlight control, pwm capable
int fanpwm = 9; // digital pin 9: 120a pwm controlled dc fan\motor controlled ti csd18503kcs 40v n-channel nexfet™ power mosfet
// declare variables
double temperatureval; // variable store value analog temperature probe
// initialize library numbers of interface pins
liquidcrystal lcd(2, 1,4, 5, 6, 7);
void setup() {
//set io pins
pinmode(3, output); //set output pin lcd backlight control
pinmode(9, output); //set output pin pwm controlled dc fan
//turn on lcd backlight
digitalwrite(3, high);
// set lcd's number of columns , rows:
lcd.begin(16, 2);
lcd.print("loading...");
delay(2000);
lcd.clear(); // clear screen
}
void loop() {
temperatureval = analogread(temperatureadc); // reads value of temperature probe (value between 0 , 1023; value range tbd)
temperatureval = map(temperatureval, 0, 1023, 0, 255); // scale use values between 0 , 255
analogwrite(fanpwm, temperatureval); // write scaled value pwmfan pin
//write percentage\value lcd
lcd.setcursor(0, 0);
lcd.print((temperatureval/255)*100);
delay(1);
}
yes possible. think want have @ sprintf function.
Arduino Forum > Using Arduino > Programming Questions > Printing Percentages to LCD
arduino
Comments
Post a Comment