Skip to main content
Arduino

Return to Answer

replaced http://arduino.stackexchange.com/ with https://arduino.stackexchange.com/
Source Link

Is there a simple way to convert to date-time object?

Not with this library. But you can find other libraries supporting the DS3232 which work with the Arduino Time library. This time library provides both the date and time in a single object, either:

  • a time_t, which is just the number of seconds elapsed since a standard "epoch"
  • a tmElements_t struct, which has the date and time broken into separate elements (year, month, day, hour...).

Then calculate sunrise and sunset times based on latitude?

There are quite a few algorithms describes on the Web for that. The more accurate ones are also the more complex.

#include <SoftI2C.h>

Doesn't your Arduino have a hardware I2C port? That would be more efficient than software emulation.

Serial.flush(); //needed before sleepy

It's only needed if you are actually using the serial port.

Edit: I saw on your other question other question that you have been bitten by an incompatibility between the Arduino Time library and the file time.h from avr-libc. Now I just noticed that avr-libc includes the functions sun_rise() and sun_set() that you may find handy. Not sure they will play well with the Arduino time libraries though. One possible incompatibility is the fact that they use different epochs for defining time_t (year 1970 v.s. 2000).

Is there a simple way to convert to date-time object?

Not with this library. But you can find other libraries supporting the DS3232 which work with the Arduino Time library. This time library provides both the date and time in a single object, either:

  • a time_t, which is just the number of seconds elapsed since a standard "epoch"
  • a tmElements_t struct, which has the date and time broken into separate elements (year, month, day, hour...).

Then calculate sunrise and sunset times based on latitude?

There are quite a few algorithms describes on the Web for that. The more accurate ones are also the more complex.

#include <SoftI2C.h>

Doesn't your Arduino have a hardware I2C port? That would be more efficient than software emulation.

Serial.flush(); //needed before sleepy

It's only needed if you are actually using the serial port.

Edit: I saw on your other question that you have been bitten by an incompatibility between the Arduino Time library and the file time.h from avr-libc. Now I just noticed that avr-libc includes the functions sun_rise() and sun_set() that you may find handy. Not sure they will play well with the Arduino time libraries though. One possible incompatibility is the fact that they use different epochs for defining time_t (year 1970 v.s. 2000).

Is there a simple way to convert to date-time object?

Not with this library. But you can find other libraries supporting the DS3232 which work with the Arduino Time library. This time library provides both the date and time in a single object, either:

  • a time_t, which is just the number of seconds elapsed since a standard "epoch"
  • a tmElements_t struct, which has the date and time broken into separate elements (year, month, day, hour...).

Then calculate sunrise and sunset times based on latitude?

There are quite a few algorithms describes on the Web for that. The more accurate ones are also the more complex.

#include <SoftI2C.h>

Doesn't your Arduino have a hardware I2C port? That would be more efficient than software emulation.

Serial.flush(); //needed before sleepy

It's only needed if you are actually using the serial port.

Edit: I saw on your other question that you have been bitten by an incompatibility between the Arduino Time library and the file time.h from avr-libc. Now I just noticed that avr-libc includes the functions sun_rise() and sun_set() that you may find handy. Not sure they will play well with the Arduino time libraries though. One possible incompatibility is the fact that they use different epochs for defining time_t (year 1970 v.s. 2000).

+ sun_rise() and sun_set() from avr-libc.
Source Link
Edgar Bonet
  • 45.1k
  • 4
  • 42
  • 81

Is there a simple way to convert to date-time object?

Not with this library. But you can find other libraries supporting the DS3232 which work with the Arduino Time library. This time library provides both the date and time in a single object, either:

  • a time_t, which is just the number of seconds elapsed since a standard "epoch"
  • a tmElements_t struct, which has the date and time broken into separate elements (year, month, day, hour...).

Then calculate sunrise and sunset times based on latitude?

There are quite a few algorithms describes on the Web for that. The more accurate ones are also the more complex.

#include <SoftI2C.h>

Doesn't your Arduino have a hardware I2C port? That would be more efficient than software emulation.

Serial.flush(); //needed before sleepy

It's only needed if you are actually using the serial port.

Edit: I saw on your other question that you have been bitten by an incompatibility between the Arduino Time library and the file time.h from avr-libc. Now I just noticed that avr-libc includes the functions sun_rise() and sun_set() that you may find handy. Not sure they will play well with the Arduino time libraries though. One possible incompatibility is the fact that they use different epochs for defining time_t (year 1970 v.s. 2000).

Is there a simple way to convert to date-time object?

Not with this library. But you can find other libraries supporting the DS3232 which work with the Arduino Time library. This time library provides both the date and time in a single object, either:

  • a time_t, which is just the number of seconds elapsed since a standard "epoch"
  • a tmElements_t struct, which has the date and time broken into separate elements (year, month, day, hour...).

Then calculate sunrise and sunset times based on latitude?

There are quite a few algorithms describes on the Web for that. The more accurate ones are also the more complex.

#include <SoftI2C.h>

Doesn't your Arduino have a hardware I2C port? That would be more efficient than software emulation.

Serial.flush(); //needed before sleepy

It's only needed if you are actually using the serial port.

Is there a simple way to convert to date-time object?

Not with this library. But you can find other libraries supporting the DS3232 which work with the Arduino Time library. This time library provides both the date and time in a single object, either:

  • a time_t, which is just the number of seconds elapsed since a standard "epoch"
  • a tmElements_t struct, which has the date and time broken into separate elements (year, month, day, hour...).

Then calculate sunrise and sunset times based on latitude?

There are quite a few algorithms describes on the Web for that. The more accurate ones are also the more complex.

#include <SoftI2C.h>

Doesn't your Arduino have a hardware I2C port? That would be more efficient than software emulation.

Serial.flush(); //needed before sleepy

It's only needed if you are actually using the serial port.

Edit: I saw on your other question that you have been bitten by an incompatibility between the Arduino Time library and the file time.h from avr-libc. Now I just noticed that avr-libc includes the functions sun_rise() and sun_set() that you may find handy. Not sure they will play well with the Arduino time libraries though. One possible incompatibility is the fact that they use different epochs for defining time_t (year 1970 v.s. 2000).

Source Link
Edgar Bonet
  • 45.1k
  • 4
  • 42
  • 81

Is there a simple way to convert to date-time object?

Not with this library. But you can find other libraries supporting the DS3232 which work with the Arduino Time library. This time library provides both the date and time in a single object, either:

  • a time_t, which is just the number of seconds elapsed since a standard "epoch"
  • a tmElements_t struct, which has the date and time broken into separate elements (year, month, day, hour...).

Then calculate sunrise and sunset times based on latitude?

There are quite a few algorithms describes on the Web for that. The more accurate ones are also the more complex.

#include <SoftI2C.h>

Doesn't your Arduino have a hardware I2C port? That would be more efficient than software emulation.

Serial.flush(); //needed before sleepy

It's only needed if you are actually using the serial port.

AltStyle によって変換されたページ (->オリジナル) /