I'm trying to read and display DS18B20 temperature sensor data on a TM1637 4-digit display. I've gotten everything to work perfectly on my Uno, but when I tried to shrink my project to an ATtiny84 I was having trouble using OneWire to read the temp data. After debugging a little I noticed that it gets stuck in the "search for device" loop. I've tried using all other ports and even tried using the ATtiny85, but with the same problem. Is it something I have to change within the OneWire library to work with tiny84?
if ( !ds.search(addr))
{
ds.reset_search();
delay(250);
return;
}
I just started with ATtiny84. I find the pin assignments confusing, especially compared to what the OneWire library takes.
This initialization of a OneWire object takes a pin to run the 1-wire bus on:
OneWire ds(3);
but by trial and error I found that it is physical pin 9 on my ATtiny84A. I might be missing an include file to get the assignments correct. (I have NOT installed the ATtiny core into my Arduino build environment.)
I'd recommend really learning what you should put as an argument to the OneWire object constructor, which is what I intend to do.
P.P.S I have now had good success installing this ATTiny core: http://highlowtech.org/?p=1695. Nice detailed instructions. Physical pin 6 an ATtiny84 is Arduino pin 7 according to this core, so I change the OneWire object instantiation to
OneWire ds(7);
and readings are coming in fine now. I'm sending them over I2c to another Arduino.