ajr27
July 14, 2022, 1:10pm
1
Hello, i am fairly new to playing around with arduinos and i've ran into a problem, i keep getting an error on a script that i have thrown together in hopes of it working (it probably won't there is no doubt a billion things worng with it heres the script, hopefully someone smarter can figure out the issue.
#define RT0 10000 // Ω
#define B 3977 // K
#define VCC 5 //Supply voltage
#define R 10000
#include <LiquidCrystal.h>
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
lcd.begin(16, 2);
lcd.print("serial.output");
lcd.setCursor(0,1);
lcd.print("");
}
void loop() {
}
float RT, VR, ln, TX, T0, VRT;
Serial.begin(9600);
T0 = 25 + 273.15;
}
void loop() {
VRT = analogRead(A0);
VRT = (5.00 / 1023.00) * VRT;
VR = VCC - VRT;
RT = VRT / (VR / R);
ln = log(RT / RT0);
TX = (1 / ((ln / B) + (1 / T0)));
TX = TX - 273.15;
Serial.print("Temperature:");
Serial.print("\t");
Serial.print(TX);
Serial.print("C\t\t");
Serial.print(TX + 273.15);
Serial.print("K\t\t");
Serial.print((TX * 1.8) + 32);
Serial.println("F");
delay(500);
{
ajr27:
void loop() {
}
How many loop() functions do you want to have?
ajr27:
float RT, VR, ln, TX, T0, VRT;
Serial.begin(9600);
T0 = 25 + 273.15;
}
That code is not in a function and has an extra thingy.
ajr27:
Serial.begin(9600);
is typically placed in setup().
It always helps if you post the error messages you see.
The IDE even has a control to help you.
Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advice on) your project.
Thanks for using code tags in your first post.
Your (second) loop() function should end in '}', not '{'.
Here is my best guess of what you meant to write. It compiles but I don't know if it 'works'.
#include <LiquidCrystal.h>
#define RT0 10000 // Ω
#define B 3977 // K
#define VCC 5 //Supply voltage
#define R 10000
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup()
{
Serial.begin(9600);
lcd.begin(16, 2);
lcd.print("serial.output");
lcd.setCursor(0, 1);
lcd.print("");
}
void loop()
{
float RT, VR, ln, TX, T0, VRT;
T0 = 25 + 273.15;
VRT = analogRead(A0);
VRT = (5.00 / 1023.00) * VRT;
VR = VCC - VRT;
RT = VRT / (VR / R);
ln = log(RT / RT0);
TX = (1 / ((ln / B) + (1 / T0)));
TX = TX - 273.15;
Serial.print("Temperature:");
Serial.print("\t");
Serial.print(TX);
Serial.print("C\t\t");
Serial.print(TX + 273.15);
Serial.print("K\t\t");
Serial.print((TX * 1.8) + 32);
Serial.println("F");
delay(500);
}
ajr27
July 15, 2022, 7:38am
7
theres alot of things that need to be ironed out, its really just two scripts jammed together
You just jammed them together wrong.
system
Closed
June 8, 2023, 4:30am
10
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.