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 : useful apps ?
Author | Message | ||||
Vikingboy Regular Member Joined: 23/09/2011 Location: AustraliaPosts: 82 |
Hi all, I have been busy playing and experimenting with my maximite and enjoying it very much, Yesterday I was reading instructables and came accross this article: http://www.instructables.com/id/Arduino-powered-Haunted-Mans ion-Signing-Busts/step2/Software-Lets-go-to-the-head-of-the- class/ Basically it is a guy using an arduino to trigger an application on his PC via the serial port using a couple of apps on the PC: AAC Keys : which takes input from the serial port and turns it into keystrokes on the PC. and Auto Hot Key: a basic macro recording app for the PC that reads the keystrokes and runs the requested apps etc. This looked very interesting to me, there could be allot of use in triggering various apps, even sending emails and using the maximite via a modem to remotely control a pc from the other side of the country/world :) Problem was could I send data back up the USB cable to the PC from the Maximite ? I read the manual and it states that the only accessible serial ports are on the appropriate pins. Anyway I gave it a bash and ran AAC keys anyway. to my surprise and delight after running it and entering the port number the maximite device was on, everything I typed on the maximite keyboard appeared on the pc :) eg open text editors,web addresses,emails etc. I then made a simple script and ran Autohotkeys as well and it all worked perfectly as advertised. The only drawbacks are that everything that appears on the maximite screen is transmitted. It would be really nice if there was a way to 'OPEN' and write to the USB in the same way as the other serial ports somehow. I found though that in Autohotkeys it supports "hot strings" so to avoid the possibilty of sending a random character and triggering your macro you can assign the macro to a unusual combination like "xzymm" and it will only trigger on receiving that exact sequence. Only last problem is that it seems to beep on every received character >:( but I havn't looked to see if there is an option to disable that. Well I hope that I am not repeating something that was already common knowledge, but I found it interesting and gave me some ideas for further experimenting anyway :) Andrew |
||||
donmck Guru Joined: 09/06/2011 Location: AustraliaPosts: 1313 |
Just a quick tip Andrew. If you wish to insert a link, use the link icon above: http://www.instructables.com/id/Arduino-powered-Haunted-Mans ion-Signing-Busts/step2/Software-Lets-go-to-the-head-of-the- %20class/ as standard URLs will have a space in them and won't work. Yours doesn't, but the above link is correct. It is confusing, but that is the only way to get links to work correctly. Cheers Don... https://www.dontronics.com |
||||
Vikingboy Regular Member Joined: 23/09/2011 Location: AustraliaPosts: 82 |
Thanks Don, I Will remember for next time :) Andrew |
||||
donmck Guru Joined: 09/06/2011 Location: AustraliaPosts: 1313 |
BTW I am an AHK person myself, and can see what you have done. I'm sure if the need is there to toggle USB comms, then it will be written by someone eventually. I think it has been spoken about by Geoff, but the amount of CPU time saved was minimal, so it has been bypassed, but if there is another reason, then it may well happen. Cheers Don... https://www.dontronics.com |
||||
Vikingboy Regular Member Joined: 23/09/2011 Location: AustraliaPosts: 82 |
Well , I have been experimenting some more with this, and have found a couple problems, I read in another recent thread how another user was using a similar program set to automatically load the time and date into the maximite from a connected PC and thought that it should be doable with these apps also so set out to try it. After allot of fiddling and trial and error I finally worked out the syntax and scripting etc to the point where typing "timeplease" into the maximite would automatically run a script on the PC. Due to not being able to have AACkeys and hyperterm use the same port simultaneously the script first shuts down AACKeys app and then starts Hyperterm and using some inbuilt commands and scripting Hotkeys then types in the time and date in compatible Maximite basic, hits the enter key, then disconnects hyperterm from the port, shuts it down and re-starts AACkeys again waiting further commands...Phew ! :) This worked fine entering the command "time please" (without the space.. it keeps triggering the macro and changing windows on me :) ), into maximite or 'list'ing a program with THAT word in it and the time and date is nicely set on the maximite. The problem: When I tried to write a program to add it into my autorun.bas I hit the problem, using a print or input command to write "time please" to the screen doesn't trigger the macro :( . I even tried opening another serial port as console, hoping that it might also send the screen output to the the USB port but no :( And that is where I am, it all works but the last little step. I thought maybe if I could enter a 'list' command from a basic program ? or maybe a poke direct to the keyboard buffer ? if anyone has any ideas I would be grateful. I really think that the ability to OPEN and CLOSE the USB port for comms with an attached PC would really be useful, Another use could be if it was also possible to transfer files using that port, without a card reader on the PC it is currently not possible to transfer support files such as .fnt files etc to the maximite. rgds, Andrew PS I just tried the LIST command from within a program and surprisingly, it worked !, well, the listing worked, it failed to trigger the macro :(, immediatley after typing 'list' into the console and voila sets the time perfectly ?? any ideas ? |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6096 |
My method of letting the PC know what it meant for it is to start every line with a $. Much the same as GPS strings. To set the time on the Maximite automatically I do the following: On the Maximite: 210 print "$RP, Startup: ";DATE$;", ";TIME$ 220 230 ' [main] 240 command$= INKEY$ 250 command$= ucase$(command$) 260 IF command$= "T" THEN GOTO 310 270 IF command$= "X" THEN GOTO 610 280 IF command$= "R" THEN GOTO 680 290 GOTO 230 300 310 ' [setTime] 320 330 SETTICK 0,0 340 350 LINE INPUT x$ 360 newdate$= LEFT$(x$,10) 370 newtime$= MID$(x$,12) 380 olddate$= DATE$ 390 oldtime$= TIME$ 400 DATE$= newdate$ 410 TIME$= newtime$ In my application on the PC, I send a time and date once a day or when the PC app detects a gross time error in the reports that are sent at regular intervals. Line 210 in the Maximite signals to the PC that it has started so that could trigger the DAQsetTime routine. Liberty Basic code: [DAQsetTime] d$ = date$("mm/dd/yyyy") ausdate$=mid$(d$,4,3)+left$(d$,3)+right$(d$,4) t$=time$() #MM, "T";ausdate$;" ";t$ return Jim VK7JH MMedit MMBasic Help |
||||
Vikingboy Regular Member Joined: 23/09/2011 Location: AustraliaPosts: 82 |
Hi, Are you using just the standard on-board USB only for communications ? because in my tests hot-strings to trigger macros on the pc are not echoed from the display to the onboard USB when using Print,Input etc commands. I can only get them to trigger when directly entered from the keyboard or when it sees the string in a list command etc :( Are you using the latest firmware ? Andrew PS I wonder if this may be some kind of bug perhaps ? as it seems to me the USB would be set "AS Console" as the other serial ports can be set but not all screen output is transmitted. |
||||
Vikingboy Regular Member Joined: 23/09/2011 Location: AustraliaPosts: 82 |
I just did a quick test, with a short program: 10 CLS 20 pause 2000 30 print "timeplease" when I run hyperterm and enter 'run' the output is reflected fine in the hyperterm window, but when I close hyperterm and run AACKeys to capture the serial input, and then open a notepad .txt file for example and enter 'run', nothing more is shown. So it appears the information is reaching the serial port but not being 'seen' by AACKeys. What application are you using to capture the serial comms in your PC ? Andrew |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6096 |
I have never used AACKeys so I can't help you there. I wrote my own application in Liberty Basic to talk to the Maximite using the standard Maximite USB port. Jim VK7JH MMedit MMBasic Help |
||||
Vikingboy Regular Member Joined: 23/09/2011 Location: AustraliaPosts: 82 |
ahhh ok, I just tried the built in windows 'serial keys' accessibility option but it also behaves the same way. Any one have any ideas why this is, or a way around it ? Jim, don't suppose you would be willing to share your little miracle app ? rgds, Andrew |
||||
crackerjack Senior Member Joined: 11/07/2011 Location: AustraliaPosts: 164 |
To set the date and time on the Maximite from a Windows PC try this little Powershell script. If you have Windows Vista or Windows 7 then Powershell is there by default. XP, it needs to be installed (I think). Obviously, the line with com4 will need to be changed to suit you COM port setup. [code] $port = new-Object System.IO.Ports.SerialPort com4,9600,None,8,one $port.Open() $port.WriteLine("date$=`"" + (get-date -format ("dd/MM/yyyy")) + "`"") $port.WriteLine("time$=`"" + (get-date -format ("hh:mm:ss")) + "`"") $port.Close() [/code] Worked for me before I setup my RTC and I still use it to synchronise times as the RTC drifts a little over time (no puns intended). |
||||
Vikingboy Regular Member Joined: 23/09/2011 Location: AustraliaPosts: 82 |
hi cracker, Thanks for your code piece ,unfortunately that part is not the problem. I Can set the time to the maximite no problem at all, hard part is to get the maximite to trigger it automatically, would you be able to add monitoring the port for a trigger word to your script ? Then we just have to see if the word gets there, using AACKeys and windows serial keys it dosn't see anything 'print'ed to the screen, only direct keyboard input for some reason. thanks, Andrew |
||||
roleyrev Newbie Joined: 13/10/2011 Location: New ZealandPosts: 8 |
Hi, Have you tried EventGhost to do some of this stuff? Check out the DC Motor PWM post. EG is a really easy way to comunicate with serial ports - Maximite USB. It can also emulate keystrokes and control other running programs. I have used it to set date and time on Maximites request. hope this helps - EG is a free download Cheers John |
||||
Vikingboy Regular Member Joined: 23/09/2011 Location: AustraliaPosts: 82 |
Thanks John, See the DC Motor PWM post I got it working now with EG. rgds, Andrew |
||||
Print this page |