Running string

#include <math.h> #include <LiquidCrystal.h> #include <string.h> #define TERMIST_B 4300 #define VIN 5.0 #define TIME 50 int currentTime = 0; int pastTime1 = 0; int pastTime2 = 0; int cursorPlace1 = 13; LiquidCrystal lcd(13, 12, 11, 10, 9, 8); void setup() { lcd.begin(16, 2); lcd.setCursor(0, 0); Serial.begin(9600); } void loop() { float voltage = analogRead(A0) * VIN / 1023.0; float r1 = voltage / (VIN - voltage); float temperature; temperature = 1./( 1./(TERMIST_B)*log(r1)+1./(25. + 273.) ) - 273; lcd.setCursor(1, 1); lcd.print(temperature, 3); lcd.print("C"); char string[50] = "Temperature: "; int razmer = strlen(string); currentTime = millis(); if ((currentTime - pastTime1) >= TIME) { cursorPlace1 = razmer - (razmer - cursorPlace1 + 1) % razmer; pastTime1 = currentTime; lcd.setCursor(0, 0); lcd.print(" "); } lcd.setCursor(cursorPlace1, 0); lcd.print(string); }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.