The TMP36 library is a very simple Arduino library that converts the analog values from a TMP36 temperature sensor directly into Celsius and Fahrenheit so you don't have to.
Using the library is very easy, and there are only a few functions to learn.
TMP36 name(pin, voltage)- Creates an instance of the class where name is a name you choose, pin is the pin the TMP36 is connected to, and voltage is the voltage applied to the sensor(5 for 5v Arduino, 3.3 for 3.3v Arduino). Check out this tutorial for more information.name.getVoltage()- Returns the voltagename.getTempF()- Returns the temperature in Fahrenheitname.getTempC()- Returns the temperature in Celsiusname.getTempK()- Returns the temperature in Kelvin
The SerialTemp example included writes the temperature in both scales to the serial monitor.
New example sketch ConsoleSerialTemp is exactly the same as SerialTemp, but it uses the Console.
I cleaned up the cpp code to make it a little more efficient, and added the option to specify the voltage applied to the TMP36.
Fixed spelling of celsius.
Added Kelvin because why not.
Copyright 2020 Isaac100
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.