Im working on project wich need time based actions. Im using udp protocol to communicate betwen c#(its just to send settings) and arduino. I want to know how to send real time and date from pc (c#) to arduino. I cand found working example.
Most communications involving time deal with what's called Unix Time. Your mission (should you decide to accept it) is to learn how to extract Unix Time (signed 32-bit integer) from your C# application and serially transmit to Arduino and use almost any time library (there are about a zillion and a half of them) to convert to year, month, day, hour, minute, second. Pretty simple once you get the comm link working.
I want to know how to send real time and date from pc (c#) to arduino.
There are two parts to this. First, you need to get the date and time, on the PC. That is NOT an Arduino question, but it is trivial in C# (DateTime.Now).
Second, you need to send the date and time to the serial port. How you do that (as binary data, as a string, as a unix time, etc.) depends on WHY you want to send the data to the Arduino.
You have not bothered to explain that, so you are on your own to figure out how to do it.
Thanks for all answers. I Will try to get time and date in ms in c# and then send it to arduino over udp string and save with SetTime(c# string converted to long).
I will give you results.
smartik:
Thanks for all answers. I Will try to get time and date in ms in c# and then send it to arduino over udp string and save with SetTime(c# string converted to long).
I will give you results.
Thanks again
not ms, time in seconds from 1970. it is called Unix Epoch or Epoch