EDIT: I am slowly loosing my mind here. I added the serial print code into my sketch and tryed it - guess what - the whole thing works. I can't try the actual serial print on my board because I don't have serial interface (so I tryed it with arduino board). They are basicly the same - the only difference is in the crystal. My board has 8MHz crystal and arduino has 16MHz crystal.
The only software change is the Serial.print and I set the clock without user interaction. If I put this onto my board - the whole thing doesn't work.
If that code is working then the problem is not with your hardware or the Time library so you need to look at the rest of the sketch code to see what is causing the problem. Try building up the code as suggested in the post above until you can isolate the cause.
My sketch is working too! Until I put the atmega from the Duemilanove board onto my board. The only other explanation is that the time is correct and something is wrong with the actual display. But I can't test that without the serial interface on my board.
The only other explanation is that the time is correct and something is wrong with the actual display.
sounds like that is the case
But I can't test that.
If you can run both boards at the same time, perhaps you can use NewSoftSerial on the Duemilanove so that it can receive serial messages from your other boar and relay them to the serial monitor so you can see what is happening.
If you can run both boards at the same time, perhaps you can use NewSoftSerial on the Duemilanove so that it can receive serial messages from your other boar and relay them to the serial monitor so you can see what is happening.
For some reson I can't get them to talk! I connected the my arduino board RX and TX pins (I used standard serial communication) to pns 2, 3 on my Duemilanove board (using the NewSoftSerial).
THis is the code on Duemilanove:
#include <NewSoftSerial.h>
NewSoftSerial mySerial(2, 3);
void setup()
{
Serial.begin(9600);
// set the data rate for the NewSoftSerial port
mySerial.begin(9600);
Serial.print("jahu");
}
void loop() // run over and over again
{
if (mySerial.available()) {
Serial.print(mySerial.read());
}
}
For some reason the only thing that is actualy sent is the "jahu" message. After that there is nothing.
I did something else. Instead of hours I started displaying seconds. And I notecd that one second was actualy about two seconds ;D. I also changed the refresh rate of the display. I can now see the display refreshing but still keeping the same number. That means that there is nothing wrong with the actual display.
the sketch posted in reply #19 displays seconds and this works correctly on my hardware, are you saying that code does not increment seconds correctly on your board?
If you have done a test version that prints the time to the serial port I would be happy to try it on my hardware.
As I said - it does work with serial communication on a duemilanove board. I don't think that it works when I put the chip onto my board that has 8MHz crystal. But since I can't get serial communication to work there I can be 100% sure. But if I can get the serial communication to work somehow - I can post some real results.
EDIT: Did another of my quick tests - I just checked if my display code can actualy refresh the numbers faster than 1s - it can. So for some reason on my board 1s is 2s long. But for some reason the chip works when it is in the Duemilanove board and it is printing time to the serial port.
Since I can't get the Duemilanove to relay messages from my board to the computer, I need some other way to get serial communication. Probably I can't just wire a Serial connector to RX and TX pins (if I remember right the serial connection works at 12V)? >:(
perhaps you can use NewSoftSerial on the Duemilanove so that it can receive serial messages from your other board and relay them to the serial monitor so you can see what is happening.
Have a search to see if you can find information on getting two boards to talk to each other using SoftSerial or NewSoftSerial.
That is what I have been trying to do. Look at the post #24 - I posted the code that I am running on The Duemillanove (that is connected to the computer). I connected the TX and RX pins of my board to pins 2 and 3 on Duemillanove. Then I used simple test like Serial.print("something"); on my board. But for some reason the Duemillanove never gets the messages from my board.
Perhaps double check that the send pin is connect to receive and vica versa.
Also, make sure that the Gnd pins on the two boards are connected together.
I didn't know that the grounds must be connected too. But connecting them doesn't help. Still no data. I tryed switching the RX and TX lines too - no change.
Then I used simple test like Serial.print("something"); on my board. But for some reason the Duemillanove never gets the messages from my board.
It is your code (from post #19). I just added setTime(0,0,0,1,1,2010);
The code you mentioned previously was not the code I posted.
If you are not able to send data from one board to another using the serial port, the most likley causes are in the wiring and the code being run. If you are sure your wiring is correct then perhaps double check that you are uploading the correct code to each board.
Its probably something simple and will spring to life when you find it.
At first I was trying with my own code. But when that didn't work I used your code. I have been trying for the past few days to get this to work. And you are probably right. Something simple, but I can't find it.
Yesterday I finaly started to get some output - even if it was just random numbers (there were no charaters - just numbers). But then I uploaded a sketch with a few Serial.prints added and it stopped working.
Good to hear that you finally got it working.
You may have gotten there sooner had you started this thread with some indication that you expected the problem was hardware related. Your post that first mentions the crystal (#5) describes the problem in a way that does not seem to be related to the crystal at all.