/*
//Sensor temperatura y display 4*7segments
//Muestra 4 digitos con punto decimal
///////////////////////////////////////////////////////////
#include <SevSeg.h>
SevSeg sevseg; //Instanciamos el objeto SevSeg
void setup() {
// put your setup code here, to run once:
byte numDigits = 4;
byte digitPins[] = {2, 3, 4, 5};
byte segmentPins[] = {11, 13, 7, 9, 10, 12, 6, 8};;
bool resistorsOnSegments = false; // 'false' means resistors are on digit pins
byte hardwareConfig = COMMON_ANODE; // See README.md for options
bool updateWithDelays = false; // Default 'false' is Recommended
bool leadingZeros = false; // Use 'true' if you'd like to keep the leading zeros
bool disableDecPoint = false; // Use 'true' if your decimal point doesn't exist or isn't connected
sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments,
updateWithDelays, leadingZeros, disableDecPoint);
sevseg.setBrightness(90);
}
// Main function, get and show the temperature
void loop(void)
{
// After we got the temperatures, we can print them here.
const float BETA = 3950; // should match the Beta Coefficient of the thermistor
int analogValue = analogRead(A0);
float celsius = 1 / (log(1 / (1023. / analogValue - 1)) / BETA + 1.0 / 298.15) - 273.15;
if (celsius!=0){
int temp=celsius*100;
sevseg.setNumber(temp,2);
}
sevseg.refreshDisplay(); // Must run repeatedly
}
//////////////////////////////////////////////////////
*/
//Sensor temperatura y display 4*7segments
//Muestra 2 digitos con la C de Celsius
///////////////////////////////////////////////////////////
#include <SevSeg.h>
SevSeg sevseg; //Instanciamos el objeto SevSeg
char temp[4]="-- C";
void setup() {
// put your setup code here, to run once:
byte numDigits = 4;
byte digitPins[] = {2, 3, 4, 5};
byte segmentPins[] = {11, 13, 7, 9, 10, 12, 6,8};;
bool resistorsOnSegments = false; // 'false' means resistors are on digit pins
byte hardwareConfig = COMMON_ANODE; // See README.md for options
bool updateWithDelays = false; // Default 'false' is Recommended
bool leadingZeros = false; // Use 'true' if you'd like to keep the leading zeros
bool disableDecPoint = false; // Use 'true' if your decimal point doesn't exist or isn't connected
sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments,
updateWithDelays, leadingZeros, disableDecPoint);
sevseg.setBrightness(90);
}
// Main function, get and show the temperature
void loop(void)
{
// After we got the temperatures, we can print them here.
const float BETA = 3950; // should match the Beta Coefficient of the thermistor
int analogValue = analogRead(A0);
float celsius = 1 / (log(1 / (1023. / analogValue - 1)) / BETA + 1.0 / 298.15) - 273.15;
if (celsius != 0){
int gradC=celsius;
String TEMP=String(gradC);
for (int i=0;i<2;i++){temp[i]=TEMP.charAt(i);}
sevseg.setChars(temp);
}
sevseg.refreshDisplay(); // Must run repeatedly
}
//////////////////////////////////////////////////////