Problem <Wire.lib> and <OneWire.lib> and <RTClib.h>
hi folks,
i using dht11 sensor , ds1820 sensor read data , write them connetced sd-card , usb-port, can catch datas pc-software - works well.
since pushed pc datetime stream written timestamp read datas.
i using actual follwoing libs:
#include <onewire.h>
#include <softwareserial.h>
#include <dht11.h>
#include <spi.h>
#include <sd.h>
//#include <wire.h>
//#include <rtclib.h>
now got rtc ds1307 , connected i2c-pins on uno - works also, "stand alone", means demo sketch working fine.
when want read datas within sketch there problem occurs- chip resets after seconds each time.
when disable <rtclib.h> , <wire.h> works fine (after remming parts needs libs)
does know going wrong ?
this demo code using , works well:
as see, not complicated code, part @ buttom not needed, date , time.
as written, works fine - not after implementing in code.
 							i using dht11 sensor , ds1820 sensor read data , write them connetced sd-card , usb-port, can catch datas pc-software - works well.
since pushed pc datetime stream written timestamp read datas.
i using actual follwoing libs:
#include <onewire.h>
#include <softwareserial.h>
#include <dht11.h>
#include <spi.h>
#include <sd.h>
//#include <wire.h>
//#include <rtclib.h>
now got rtc ds1307 , connected i2c-pins on uno - works also, "stand alone", means demo sketch working fine.
when want read datas within sketch there problem occurs- chip resets after seconds each time.
when disable <rtclib.h> , <wire.h> works fine (after remming parts needs libs)
does know going wrong ?
this demo code using , works well:
code: [select]
// date , time functions using software, based on millis() & timer
#include <wire.h>
#include "rtclib.h"
rtc_millis rtc;
void setup () {
    serial.begin(57600);
    // following line sets rtc date & time sketch compiled
    rtc.begin(datetime(__date__, __time__));
}
void loop () {
    datetime = rtc.now();
    
    serial.print(now.year(), dec);
    serial.print('/');
    serial.print(now.month(), dec);
    serial.print('/');
    serial.print(now.day(), dec);
    serial.print(' ');
    serial.print(now.hour(), dec);
    serial.print(':');
    serial.print(now.minute(), dec);
    serial.print(':');
    serial.print(now.second(), dec);
    serial.println();
    
    serial.print(" seconds since 1970: ");
    serial.println(now.unixtime());
    
    // calculate date 7 days , 30 seconds future
    datetime future (now.unixtime() + 7 * 86400l + 30);
    
    serial.print(" + 7d + 30s: ");
    serial.print(future.year(), dec);
    serial.print('/');
    serial.print(future.month(), dec);
    serial.print('/');
    serial.print(future.day(), dec);
    serial.print(' ');
    serial.print(future.hour(), dec);
    serial.print(':');
    serial.print(future.minute(), dec);
    serial.print(':');
    serial.print(future.second(), dec);
    serial.println();
    
    serial.println();
    delay(3000);
}
as see, not complicated code, part @ buttom not needed, date , time.
as written, works fine - not after implementing in code.
with many libraries, might run out of ram on arduino uno.
you take here, http://playground.arduino.cc/code/availablememory
perhaps can add function displays free ram in setup().
or libraries use same timer. don't know library uses timer.
 							you take here, http://playground.arduino.cc/code/availablememory
perhaps can add function displays free ram in setup().
or libraries use same timer. don't know library uses timer.
            						 					Arduino Forum  						 						 							 >   					Using Arduino  						 						 							 >   					Project Guidance  						 						 							 >   					Problem <Wire.lib> and <OneWire.lib> and <RTClib.h>  						 					
arduino
 
  
Comments
Post a Comment