I just received my first 2 Moteinos and am embarking on an HVAC monitoring project. I'd like to use the DS18B20 sensors as I have some lying around and am very interested in the slimmed down, non-blocking code that user ChemE posted https://github.com/cdl1051/DS18B20_NROO. My questions are:
1. Can I use Pins other than 12 and 13 as those are currently used for SPI?
2. Is changing the Pins used for DS18B20 as simple as changing the "Pin" and "PowerPin" definitions in the DS18B20.h file to something like PD4 and PD7?
3. Would I need to change the code below if I use different Pins or is that just referencing whatever is defined in the DS18B20.h file?
DDRB = B00011000; // Set Pin 12 as an output
Thanks for any help with this. I am a bit new to C/C++ coding.
Justin
Well I ended up figuring this out after all. In the DS18B20.h file I simply changed the Pin and PowerPin to PD7 and PD4 respectively. I also changed all of the PORTB/DDRB/PINB references to be PORTD/DDRD/PIND to coincide with the change in Pin use. Also, in the .ino file I changed DDRB to DDRD as well. Everything worked great after that.
Justin
Sorry I missed this thread, I just now stumbled upon it! Glad you were able to modify my code to suit your needs. Do let me know if you need anything else on it.