Hello, I'm trying to build a temperature sensor using the Attiny1614 using a 0.96 oled and a DS18B20 temperature sensor. I mange to get the oled working by using the Tiny4Koled. here. Also I found the DS18B20 temperature here. For some unknown reason beyond my programming skills I can not get the Temperarure sensor working. The attiny1614 does have spi and i2c on it. But not serial. well it does have serial but i would need to hook up a FTDI to it for it to work. The Attiny1614 programs by UPDI. I really need help to figure out what is wrong. Can someone help me please? My sketch is below.
Edit: I get no errors in compiling. I just get no temperature.
/*
* Tiny4kOLED - Drivers for SSD1306 controlled dot matrix OLED/PLED 128x32 displays
*
* Based on ssd1306xled, re-written and extended by Stephen Denne
* from 2017-04-25 at https://github.com/datacute/Tiny4kOLED
*
* This example shows how the scrolling features work.
* When scrolling, the double buffering of screens cannot be used.
*
*/
// Choose your I2C implementation before including Tiny4kOLED.h
// The default is selected is Wire.h
// To use the Wire library:
//#include <Wire.h>
// To use the Adafruit's TinyWireM library:
//#include <TinyWireM.h>
// To use the TinyI2C library from https://github.com/technoblogy/tiny-i2c
//#include <TinyI2CMaster.h>
#include <Tiny4kOLED.h>
#include <OneWire.h>
#include <DallasTemperature.h>
// Data wire is plugged into port 2 on the Arduino
#define ONE_WIRE_BUS 8
// 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);
/*
* The setup function. We only start the sensors here
*/
void setup() {
// Start up the library
sensors.begin();
oled.begin();
oled.clear();
oled.on();
oled.setFont(FONT6X8);
oled.setCursor(0, 0);
oled.invertOutput(false);
oled.println("Temperature");
delay(500);
}
void loop() {
// call sensors.requestTemperatures() to issue a global temperature
// request to all devices on the bus
//Serial.print("Requesting temperatures...");
sensors.requestTemperatures(); // Send the command to get temperatures
// Serial.println("DONE");
// After we got the temperatures, we can print them here.
// We use the function ByIndex, and as an example get the temperature from the first sensor only.
float tempC = sensors.getTempCByIndex(0);
// Check if reading was successful
if(tempC != DEVICE_DISCONNECTED_C)
{
// Serial.print("Temperature for the device 1 (index 0) is: ");
// Serial.println(tempC);
oled.setFont(FONT6X8);
oled.setCursor(0, 10);
oled.invertOutput(false);
oled.println(tempC);
delay(500);
}
else
{
oled.setCursor(0, 10);
oled.setFont(FONT8X16);
oled.print("Not Found");
oled.clearToEOL();
delay(500);
// Serial.println("Not Found");
}
}
Joseph

