Temperature based controlled fan arduino code


plz am newbie in coding ,,,,what does this error solved" readTemp not decleared in this page" help plz

It means you haven't defined a variable called "temp" to receive the value returned from the function "readTemp"

And then the compiler is going to whine about you having two setup functions, and about code not being in a function (though not in such simple terms)
Probably other stuff too.

Please remember to use code tags when posting code

Images of code are sub-optimal. We cannot copy the code to the IDE or a text editor for examination. Read the forum guidelines to see how to properly post code.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags. Often autoformatting will point out errors with misplaced and/or missing curly brackets, parenthesis and other formatting and syntax errors.

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.

ook. thankuu lemme do that

Arduino: 1.8.16 (Windows 10), Board: "Arduino Uno"

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\ADMIN\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10816 -build-path C:\Users\ADMIN\AppData\Local\Temp\arduino_build_519765 -warnings=none -build-cache C:\Users\ADMIN\AppData\Local\Temp\arduino_cache_224495 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose E:\INDUSTRY\DUINO CODES\sketch_oct18a\sketch_oct18a.ino

C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\ADMIN\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10816 -build-path C:\Users\ADMIN\AppData\Local\Temp\arduino_build_519765 -warnings=none -build-cache C:\Users\ADMIN\AppData\Local\Temp\arduino_cache_224495 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose E:\INDUSTRY\DUINO CODES\sketch_oct18a\sketch_oct18a.ino

Using board 'uno' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr

Using core 'arduino' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr

Detecting libraries used...

"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10816 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "C:\Users\ADMIN\AppData\Local\Temp\arduino_build_519765\sketch\sketch_oct18a.ino.cpp" -o nul

Alternatives for LiquidCrystal.h: [LiquidCrystal@1.0.7]

ResolveLibrary(LiquidCrystal.h)

-> candidates: [LiquidCrystal@1.0.7]

"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10816 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src" "C:\Users\ADMIN\AppData\Local\Temp\arduino_build_519765\sketch\sketch_oct18a.ino.cpp" -o nul

"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10816 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src" "C:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src\LiquidCrystal.cpp" -o nul

Generating function prototypes...

"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10816 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src" "C:\Users\ADMIN\AppData\Local\Temp\arduino_build_519765\sketch\sketch_oct18a.ino.cpp" -o "C:\Users\ADMIN\AppData\Local\Temp\arduino_build_519765\preproc\ctags_target_for_gcc_minus_e.cpp"

"C:\Program Files (x86)\Arduino\tools-builder\ctags\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\Users\ADMIN\AppData\Local\Temp\arduino_build_519765\preproc\ctags_target_for_gcc_minus_e.cpp"

Compiling sketch...

"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10816 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src" "C:\Users\ADMIN\AppData\Local\Temp\arduino_build_519765\sketch\sketch_oct18a.ino.cpp" -o "C:\Users\ADMIN\AppData\Local\Temp\arduino_build_519765\sketch\sketch_oct18a.ino.cpp.o"

E:\INDUSTRY\DUINO CODES\sketch_oct18a\sketch_oct18a.ino: In function 'void loop()':

sketch_oct18a:20:8: error: 'readTemp' was not declared in this scope

temp = readTemp(); // get the temperature

    ^~~~~~~~

E:\INDUSTRY\DUINO CODES\sketch_oct18a\sketch_oct18a.ino: At global scope:

sketch_oct18a:22:1: error: expected unqualified-id before 'if'

if(temp <tempMin) { // if temp is lower than minimum temp

^~

Using library LiquidCrystal at version 1.0.7 in folder: C:\Program Files (x86)\Arduino\libraries\LiquidCrystal

exit status 1

'readTemp' was not declared in this scope

hello how do i use the said code tag???

Read the page linked in reply #3.

You haven't posted your code.

I do note that you have code outside of a function - not allowed in C/C++, only declarations can be top-level.

Its essential to indent your code to match the braces to be able to see sillies like this at a glance.

Use more blank lines - whitespace allows code to be readable, just as paragraphs allow text to be readable.