Loading...
  Show Posts
Pages: [1] 2 3
1  Using Arduino / Networking, Protocols, and Devices / Re: Question regarding RTC libraries on: March 30, 2013, 08:37:34 pm
with TFT and 4.7k Ohm resistors?
2  Using Arduino / Networking, Protocols, and Devices / Re: Question regarding RTC libraries on: March 30, 2013, 08:19:28 pm
does it work now?
3  Using Arduino / Programming Questions / Re: Mega2560 + 3.2" TFT + RTC. RTC problem on: March 30, 2013, 08:15:58 pm
tried this library http://www.henningkarlsen.com/electronics:
Code:
// DS1307_Serial_Easy (C)2010 Henning Karlsen
// web: http://www.henningkarlsen.com/electronics
//
// A quick demo of how to use my DS1307-library to
// quickly send time and date information over a serial link
//
// I assume you know how to connect the DS1307.
// DS1307:  SDA pin   -> Arduino Digital 4
//          SCL pin   -> Arduino Digital 5

#include <DS1307.h>

// Init the DS1307
DS1307 rtc(20, 21);

void setup()
{
  // Set the clock to run-mode
  rtc.halt(false);
 
  // Setup Serial connection
  Serial.begin(9600);

  // The following lines can be commented out to use the values already stored in the DS1307
  rtc.setDOW(SUNDAY);        // Set Day-of-Week to SUNDAY
  rtc.setTime(12, 0, 0);     // Set the time to 12:00:00 (24hr format)
  rtc.setDate(3, 10, 2010);   // Set the date to October 3th, 2010
}

void loop()
{
  // Send Day-of-Week
  Serial.print(rtc.getDOWStr());
  Serial.print(" ");
 
  // Send date
  Serial.print(rtc.getDateStr());
  Serial.print(" -- ");

  // Send time
  Serial.println(rtc.getTimeStr());
 
  // Wait one second before repeating :)
  delay (1000);
}
without TFT on serial it is working fine
as soon as TFT inserted (without any other change) - it does not work
4  Using Arduino / Networking, Protocols, and Devices / Re: Question regarding RTC libraries on: March 30, 2013, 07:49:51 pm
...All I get is

xxxxxxxxx 85.85.2165 -- 27:85:85

Anyone have any clue about this?
...
I've figure out this:
without TFT it is working fine
when TFT is on the place - it give this result :xxxxxxxxx 85.85.2165 -- 27:85:85
Did you find a solution?
5  Using Arduino / Programming Questions / Re: Mega2560 + 3.2" TFT + RTC. RTC problem on: March 30, 2013, 05:12:19 pm
I've put
  if (! RTC.isrunning()) {
3 times
it looks like Arduino does not see the RTC device:
Code:
void setup () {
    Serial.begin(57600);
    Wire.begin();
    RTC.begin();

  if (! RTC.isrunning()) {
    Serial.println("RTC is NOT running!");
    // following line sets the RTC to the date & time this sketch was compiled
    RTC.adjust(DateTime(__DATE__, __TIME__));
  }

  if (! RTC.isrunning()) {
    Serial.println("RTC is NOT running!");
    // following line sets the RTC to the date & time this sketch was compiled
    RTC.adjust(DateTime("Dec 26 2009","12:34:56"));
  }

  if (! RTC.isrunning()) {
    Serial.println("RTC is NOT running!");
    // following line sets the RTC to the date & time this sketch was compiled
    RTC.adjust(DateTime("Dec 26 2010","1:04:06"));
  }
result:
---------
RTC is NOT running!
RTC is NOT running!
RTC is NOT running!
2165/165/165 165:165:85
 since midnight 1/1/1970 = 2028820689s = 23481d
 now + 7d + 30s: 2034/4/23 17:18:39

6  Using Arduino / Programming Questions / Re: Mega2560 + 3.2" TFT + RTC. RTC problem on: March 30, 2013, 12:04:36 pm
How is the RTC connected? Pins 20 & 21?
yes
7  Using Arduino / Programming Questions / Re: Mega2560 + 3.2" TFT + RTC. RTC problem on: March 30, 2013, 11:37:24 am
does anybody have a working example for Mega?
8  Using Arduino / Programming Questions / Mega2560 + 3.2" TFT + RTC. RTC problem on: March 30, 2013, 09:30:08 am
RTC does not work
1. download library:
http://learn.adafruit.com/ds1307-real-time-clock-breakout-board-kit/arduino-library
2. try to run the attached to the library example:
Code:
// Date and time functions using a DS1307 RTC connected via I2C and Wire lib

#include <Wire.h>
#include "RTClib.h"

RTC_DS1307 RTC;

void setup () {
    Serial.begin(57600);
    Wire.begin();
    RTC.begin();

  if (! RTC.isrunning()) {
    Serial.println("RTC is NOT running!");
    // following line sets the RTC to the date & time this sketch was compiled
    RTC.adjust(DateTime(__DATE__, __TIME__));
  }
}

void loop () {
    DateTime now = 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(" since midnight 1/1/1970 = ");
    Serial.print(now.unixtime());
    Serial.print("s = ");
    Serial.print(now.unixtime() / 86400L);
    Serial.println("d");
   
    // calculate a date which is 7 days and 30 seconds into the future
    DateTime future (now.unixtime() + 7 * 86400L + 30);
   
    Serial.print(" now + 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);
}
3. Get the result:
RTC is NOT running!
2165/165/165 165:165:85
 since midnight 1/1/1970 = 2028820689s = 23481d
 now + 7d + 30s: 2034/4/23 17:18:39

2165/165/165 165:165:85
 since midnight 1/1/1970 = 2028820689s = 23481d
 now + 7d + 30s: 2034/4/23 17:18:39

2165/165/165 165:165:85
 since midnight 1/1/1970 = 2028820689s = 23481d
 now + 7d + 30s: 2034/4/23 17:18:39

9  Using Arduino / Programming Questions / Re: reverse pow on: February 27, 2013, 09:27:49 am
... have value that increases exponentially ... and I want to decrease the value by the same amount in every step as when it was increasing.../quote]
Code:
byte ReverceByte (byte b)
{
  int i;
  i=b;
  i=-1*(i-255);
  b=i;
  return b;
}
10  Using Arduino / Programming Questions / Re: Is there any easy way to work with time intervals? on: February 26, 2013, 10:34:40 am
Quote
cold not find this function: makeTime()
You didn't look in the header file, did you?
thank a lot,
  that the one that can do all math with time intervals.
11  Using Arduino / Programming Questions / Re: Is there any easy way to work with time intervals? on: February 26, 2013, 10:09:28 am
http://playground.arduino.cc/Code/Time
 adjustTime(adjustment);
  // Adjust system time by adding the adjustment value
in this case the time will be modified.
cold not find this function: makeTime()
12  Using Arduino / Programming Questions / Is there any easy way to work with time intervals? on: February 26, 2013, 09:58:05 am
I'm trying to work with time intervals like add a time to some date, compare dates.
The code looks ugly.
From time library it easy to do with now(): it returns the time in unix format and then we can add anything.
The problem is coming when we trying to add 20 minutes to any other date:
like add 150 minutes to '2013-02-25 15:00'
13  Using Arduino / Programming Questions / Re: big int to/from EEPROM on: February 22, 2013, 11:50:49 am
There is no reason why you can't write a series of bytes to EEPROM and then put them in an array when you read them back.
Wrap the writing and reading in functions and call them when you need to and it's just like having a native function to do the same thing.
I do not know the size if it is 1 byte value or 2 bytes.
So to do this from the code: always 2 bytes have to be stored into EEPROM for each element of array.
It looks like this function is doing it: uint16_t eeprom_read_word
So, no reason to create a custom function if it exists from a standard library
Will need this function and a custom function to populate this array from EEPROM.
-----
Big thanks to everybody
14  Using Arduino / Programming Questions / Re: big int to/from EEPROM on: February 22, 2013, 11:34:46 am

wow, that is not an easy way smiley-wink
--
this code  splits the value 2114 to to bytes, right?:

Code:
unsigned char b1, b2;
int value = 2114;

b1 = value & 0xFF;
b2 = value >> 8;

Then these 2 bytes can be stored to EEPROM?:
Code:
EEPROM.write(1,b1);
EEPROM.write(2,b2);

Reading from EEPROM?:
Code:
b1= EEPROM.read(1);
b2= EEPROM.read(2);
// and result:
Code:
value = (b2 << 8) | b1;

is that right?
----

that seems equivalent:
http://www.nongnu.org/avr-libc/user-manual/group__avr__eeprom.html#gabeef2e14398b47268f88462b3d7738dc

uint16_t eeprom_read_word   (   const uint16_t *    __p )   
   Read one 16-bit word (little endian) from EEPROM address __p.

eeprom_read_word always read 2 bytes, is it correct?
15  Using Arduino / Programming Questions / Re: big int to/from EEPROM on: February 22, 2013, 11:00:04 am
how to convert the value 2114 to char and back?
Pages: [1] 2 3