Maker Pro
Maker Pro

Temperature Display LM35 on 7 Segment

AnnaRul

Dec 10, 2022
2
Joined
Dec 10, 2022
Messages
2
Hello everyone,

Need your help to display temperature on 7 Segment.
ShiftDisplay.h library is used but couldnt succeed.

Code:
#include <ShiftDisplay.h>

const int LATCH_PIN = 8;
const int CLOCK_PIN = 10;
const int DATA_PIN = 6;

const DisplayType DISPLAY_TYPE = COMMON_ANODE;                        // COMMON_CATHODE or COMMON_ANODE

const int DISPLAY_SIZE = 8 ;     // 8                                      // number of digits (Common anode or cathode) on display

ShiftDisplay display(LATCH_PIN, CLOCK_PIN, DATA_PIN, DISPLAY_TYPE, DISPLAY_SIZE);

float getTemperature() {
  delay(1000); // simulate processing
  return 21.36;
}

String getCondition() {
  delay(1000); // simulate processing
  return "Sunny";
}

void setup() {
}

void loop() {
  float temp = getTemperature();
  String condition = getCondition();
  condition = "        " + condition; // prefix with spaces

  // for 4 seconds, show temperature with one decimal, aligned to center of display // display.set(temp, 1, ALIGN_CENTER);
  display.set(temp, 1, ALIGN_CENTER); // display.set(temp, 0, ALIGN_CENTER); // No DP
  display.show(4000);

  // show condition with marquee effect
  while (condition.length() > 0) {
    display.set(condition, ALIGN_LEFT);
    display.show(500);
    condition.remove(0, 1);
  }
}
 
Last edited by a moderator:

danadak

Feb 19, 2021
751
Joined
Feb 19, 2021
Messages
751
1) Post schematic
2) Pic of your prototype setup
3) What do you observe on the display ?


Regards, Dana.
 
Top