constexpr uint8_t SAMPLES = 16;
void setup() {
Serial.begin(115200);
}
void loop() {
Serial.print("Raw: ");
Serial.print(Shield.
TempRaw(SOURCE, SAMPLES));
Serial.print(" ");
Serial.print(" mV ");
Serial.print(" °C ");
Serial.print(" °F ");
Serial.print(Shield.
TempKelvin(SOURCE, SAMPLES), 1);
Serial.println(" K");
delay(1000);
}
Library for the U of T Physics Analog Shield (Introduction to Electronics).
TempSource
Temperature signal to read with AnalogShield::TempRaw() or AnalogShield::TempMillivolts().
Definition AnalogShield.h:52
@ MCU
Conditioned signal on TEMP_SIG_MCU (A0, RP2040 ADC), JP2 at Internal.
Definition AnalogShield.h:54
Encoder, switch, temperature signals, potentiometer and LEDs on the Analog Shield.
Definition AnalogShield.h:64
int32_t TempMillivolts(TempSource source, uint8_t samples=1) const
Reads the voltage of a temperature signal.
Definition AnalogShield.cpp:216
float TempKelvin(TempSource source, uint8_t samples=1) const
Reads a temperature signal and converts it to kelvins.
Definition AnalogShield.cpp:248
float TempFahrenheit(TempSource source, uint8_t samples=1) const
Reads a temperature signal and converts it to degrees Fahrenheit.
Definition AnalogShield.cpp:244
float TempCelsius(TempSource source, uint8_t samples=1) const
Reads a temperature signal and converts it to degrees Celsius.
Definition AnalogShield.cpp:240
int TempRaw(TempSource source, uint8_t samples=1) const
Reads a temperature signal with the ADC.
Definition AnalogShield.cpp:212
bool SetAdcResolution(uint8_t bits)
Sets the ADC resolution used by analogRead() and by every reading below.
Definition AnalogShield.cpp:171
void begin()
Sets pin modes, turns both LEDs off and starts tracking the encoder and its switch.
Definition AnalogShield.cpp:56