- Arduino Uno
Ultimate GPS (for auto-setting RTC)
7-Segment LEDs
I want this to be cheap and replicable. I've just gotten a RasPi, so I might try that but a whole linux computer to make a clock seems a little crazy. Does anyone have ideas?
Moderators: adafruit_support_bill, adafruit
Code: Select all
void setup()
{
Serial.begin(9600);
Serial.println(.01);
delay(1027);
Serial.println(.02);
delay(1027);
Serial.println(.03);
delay(1027);
Serial.println(.04);
}
void loop()
{
}
Code: Select all
x / 1.027491252
Code: Select all
x * 0.973244296
Code: Select all
x - (x / 37) + (x / 3686)
Code: Select all
x - (x / 37) + (x / 3686) + (x / 38400000)
Code: Select all
k = ????; // value of earth_seconds at 00:00:00 Mars time
x = earth_seconds - k;
y = x - (x / 8) - (x / 53) + (x / 19820);
mars_seconds = (x - (y / 32));
Code: Select all
k = ????; // value of earth_seconds at 00:00:00 Mars time
x = earth_seconds - k;
y = x - (x >> 3) - (x / 53) + (x / 19820);
mars_seconds = (x - (y >> 5));
then 16MHz becomes 16,439,860MarsHz.daremick wrote:(Earth 1.0274912510416665 second = Mars 1 second)
I'm not sure if you're addressing the original poster or me because there's no name in your post. Thanks for the advice if it was for me, and if it was for me no I am not trying to avoid math my post states that I am trying to make it "simple" as in low cost hardware and minimal code (as it applies to total size, for example 12kb versus 30kb) I have no problem doing any math or in depth code, although again as I mentioned I am no programmer and this is a great learning project for me. I have no idea how to program a stepper motor let alone do math in the IDE. But unlike a lot of new people I see on these forums I am also not expecting anyone to hand me the answers. Again if that post was for me thank you for the advice I will work on this as well as my own solutions. Great support.odometer wrote:If you want an RTC backup, you will have to do conversion anyway.
I don't get why try alter the speed of an RTC or Arduino clock. Is that math really that hard?!
If you don't want to use the time information from an external RTC, then just count chunks of 1027491 microseconds in software. Each such chunk is a Mars second, more or less. When you get to 60 Mars seconds, then you have one Mars minute, etc. Counting chunks of time of arbitrary but uniform length (in out case, 1027491 microseconds) is very straightforward. Look at the "Blink without delay" example in the tutorial.
It's really not a good idea to use 1027 milliseconds to approximate 1.027491... seconds. If you do, the clock will be out two minutes in three days.
I don't understand why go so far out of your way to avoid a little math. If you are really concerned about the math slowing down the Arduino, then just do the "hard" math once every minute or so, and count chunks of 1027491 microseconds (or even 1027 milliseconds, if you like) in between.