See post # 10.
Look at the examples that come with the library.
Do you actually read my posts, or am I wasting my time?
See post # 10.
Look at the examples that come with the library.
Do you actually read my posts, or am I wasting my time?
I'm pretty sure the forum administrators aren't going to like that. There's a chance one or both of you will be banned for a while.
#include <DS18B20.h>
DS18B20 ds(2);
float temperature = 0.0f;
ds heat(DS18B20PIN);
void setup() {
Serial.begin(9600);
DS18B20.begin();
}
void loop() {
readSensor();
sendTemperatureToNextion();
delay(2000);
}
void readSensor()
{
temperature = ds.readTemperature();
}
void sendTemperatureToNextion()
{
String command = "temperature.txt=\"" + String(temperature, 1) + "\"";
Serial.print(command);
endNextionCommand();
}
void endNextionCommand()
{
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
}
I ve done something like that but know it gives me error of ds does not name a type
Please include the entire error message. It is easy to do. There is a button (lower right of the IDE window) called "copy error message". Copy the error and paste into a post in code tags. Paraphrasing the error message leaves out important information.
Arduino:1.8.19 (Windows 10), Kart:"Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"
sketch_jun16a:7:2: error: 'ds' does not name a type
ds heat(DS18B20PIN);
^~
C:\Users\ahmet\OneDrive\Belgeler\Arduino\sketch_jun16a\sketch_jun16a.ino: In function 'void setup()':
sketch_jun16a:11:10: error: expected unqualified-id before '.' token
DS18B20.begin();
^
C:\Users\ahmet\OneDrive\Belgeler\Arduino\sketch_jun16a\sketch_jun16a.ino: In function 'void readSensor()':
sketch_jun16a:22:20: error: 'class DS18B20' has no member named 'readTemperature'
temperature = ds.readTemperature();
^~~~~~~~~~~~~~~
exit status 1
'ds' does not name a type
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
The library has no begin() function. Look at the examples.
The library has no readTemperature() function. The Documentation shows a getTempC() function.
why did you not use a working example-code for DS18B20??
https://www.google.de/search?as_q=arduino+DS18B20+democode
Assuming that all sensors work the same way is a very wrong assumption.
With a democode for DS18B20 non of your errors would occur!
For asking how to solve compiler-error-messages
For posting multiple postings in a short time, the new member has to get to Discourse trust level one on the forum, which is a pretty trivial matter:
Get to trust level 1 by…
best regards Stefan
@pupuko I have suspended your account.
@dorogon Do not create multiple accounts, any more and you risk a permanent suspension. Thank you.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.