Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Powershell Date/Time Script
Author | Message | ||||
crackerjack Senior Member Joined: 11/07/2011 Location: AustraliaPosts: 164 |
Hi again one-and-all. A small tip this time. For those who don't have hardware RTC setup and want their Maximite Date and Time updated easily, the following is a small Powershell script to do so. Just run the script from your PC when you connect the MMM/DM and Date and Time is quickly set without fiddling about (or forgetting). There are probably ways of kicking off the script as soon as the USB device is detected, but I do it manually. As for Powershell scripting, that is a whole other story I won't get into now, but for those who are interested, script follows (it could undoubtedly be done in any language of choice which has Serial IO functionality): [code] $port = new-Object System.IO.Ports.SerialPort com4,9600,None,8,one $port.Open() $port.WriteLine("date$=`"" + (get-date -format ("dd/MM/yyyy")) + "`"") Start-Sleep -m 100 $port.WriteLine("time$=`"" + (get-date -format ("hh:mm:ss")) + "`"") Start-Sleep -m 100 $port.WriteLine("Cls"); $port.Close() [/code] Note the com4 in the first line should be set to whatever COM Port your MM/DM is connected to, and that the script should be run before firing up TeraTerm (,etc.) and connecting to the *Mite. Cheers. |
||||
CircuitGizmos Guru Joined: 08/09/2011 Location: United StatesPosts: 1425 |
That is pretty much the same thing that my button does in MMIDE. Very convenient to set the date/time first thing. Micromites and Maximites! - Beginning Maximite |
||||
BobD Guru Joined: 07/12/2011 Location: AustraliaPosts: 935 |
Does anybody know how to start this script on usb detection? I have been googling but no success so far. |
||||
Ray B Senior Member Joined: 16/02/2007 Location: AustraliaPosts: 219 |
Original solution to this challenge using TeraTerm as previously posted by James of Canberra as follows: http://www.thebackshed.com/forum/forum_posts.asp?TID=3582 Cheers RayB from Perth WA |
||||
crackerjack Senior Member Joined: 11/07/2011 Location: AustraliaPosts: 164 |
Thanks RayB - nice one by James. I think that was posted just before I joined the forum. Good to see a simple solution. Cheers. |
||||
Print this page |