Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C by ddd ( 6 years ago )
#include "OneWire.h"
#include "DallasTemperature.h"
#include "TM1637Display.h"
#define CLK 9
#define DIO 8
// Data wire is plugged into port 2 on the Arduino
#define ONE_WIRE_BUS 3
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature. 
DallasTemperature sensors(&oneWire);
int temperature_celsius;
const uint8_t celsius[] = {
  SEG_A | SEG_B | SEG_F | SEG_G,  // Circle
  SEG_A | SEG_D | SEG_E | SEG_F   // C
};
TM1637Display display = TM1637Display(CLK, DIO);
void setup(void)
{ 
  display.setBrightness(0);
  display.clear();
  sensors.begin();
}

void loop(void)
{ 
  sensors.requestTemperatures(); 
  temperature_celsius = sensors.getTempCByIndex(0);
  display.showNumberDec(temperature_celsius, false, 2, 0);
  display.setSegments(celsius, 2, 2);

}

 

Revise this Paste

Your Name: Code Language: