Nope; I'm completely confused
I've had a PICAXE connected to and old PC's so it could send SMS's, email and generate web pages for another PC ( or anyone in the world ) to view or receive, but I don't follow how you're imagining the setup you have and what will be doing what.
Using a PICAXE to work as a PS/2 keyboard seems overly complicated when you could just communicate via serial to what we'll call the server. Then it's just a matter of running the right application on the server to take the data it gets from the PICAXE and send it to another PC. I'm not clear on how Outlook and macros are going to help with that. I'm not sure what you mean by "encoder".
This could be a case of a picture ( or diagram ) being worth a thousand words.
Maybe I should have called this thread "Sub Standard / Poor Quality PNS" and i do pray an actual PNS will be in my birthday present stack later this month
but here's the details an pix I promised.
The encoder - (I know now, after reading one of Dr_Ac's posts that I'll be better off with VB - using the sendkeys function (i think) - In any case It was a good mental work out and quicker doing it this way with the keyboard hack - as opposed to learning to do it in VB (which is my next project).
Also a pinout for the encoder (whatever it's propper name is - i'm completely unsure and hoping hippy or anyone else can confirm
)
Also attached, a table showing how the matrix maps, shorting an
i with an
ii pin produces a character referenced in the table. A few pins were impossible to assign, but as the datasheet doesn't appear to be available and I can live without them - not really bothered for now.
Code:
#Include TXT.ahk
1::
sendinput {Tab}{Tab}{Tab}
sendinput {Enter}
FileAppend,</xml_dl>,C:\Users\Elmo\Desktop\data\data.txt
lline := TXT_Tail("c:\Users\Elmo\Desktop\data\data.txt",7)
FileCopy, C:\Users\Elmo\Desktop\data\data.txt, C:\Users\Elmo\Desktop\data\data.xml,1
sFrom := "your_email@googlemail.com"
sTo := "Any_email@hotmail.com"
sSubject := "Update - Data Logger"
sText := lline
sAttach := "C:\data\data.html"
dAttach := "C:\data.xml"
sServer := "smtp.gmail.com" ; specify your SMTP server
nPort := 465 ; 25
bTLS := True ; False
sUsername := "Your_Gmail_Username"
sPassword := "Your_Gmail_Password"
COM_Init()
pmsg := COM_CreateObject("CDO.Message")
pcfg := COM_Invoke(pmsg, "Configuration")
pfld := COM_Invoke(pcfg, "Fields")
COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/sendusing", 2)
COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout", 60)
COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/smtpserver", sServer)
COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/smtpserverport", nPort)
COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/smtpusessl", bTLS)
COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", 1)
COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/sendusername", sUsername)
COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/sendpassword", sPassword)
COM_Invoke(pfld, "Update")
COM_Invoke(pmsg, "From", sFrom)
COM_Invoke(pmsg, "To", sTo)
COM_Invoke(pmsg, "Subject", sSubject)
COM_Invoke(pmsg, "TextBody", sText)
COM_Invoke(pmsg, "AddAttachment", sAttach)
COM_Invoke(pmsg, "AddAttachment", dAttach)
COM_Invoke(pmsg, "Send")
COM_Release(pfld)
COM_Release(pcfg)
COM_Release(pmsg)
COM_Term()
FileDelete, C:\data\data.txt
FileAppend,<xml_dl>,C:\data\data.txt
sendinput {Tab}{Tab}{Tab}
sendinput C:\data\data.txt
sendinput {Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Enter}
Above is the AHK script (AutoHotKeys - suggested by Boriz) its written and based on, an auto email script originally
posted by some cool guy named Sean It also requires the
AHK TXT script.
The script runs whenever the "1" key is entered on the keyboard; The 18X I have on the Rx side of my 433MHz data logger outputs (Sertxd) data in an XML format but saved as a txt file.
e.g.
Code:
<xml_dl>
<num>1
<time>0:07:20</time>
<day>1</day>
<temp>33</temp>
</num>
<num>2
<time>0:07:30</time>
<day>1</day>
<temp>33</temp>
</num>
<num>3
<time>0:07:40</time>
<day>1</day>
<temp>33</temp>
</num>
The script's function is to stop the RS232 Data Logger Program (freeware) (
by Elmtima) from archiving. The script then appends the txt file to include the final </xml_dl> tag and saves as "data.xml" and subsequently deleting the original data.txt file.
Following on, AHK script emails the xml file to the address(es) specified, (Using gmail - has to be Gmail for this script), along with an HTML file (to allow the results to be viewed in a table format). The text body of the email also contains the last 7 lines of data, from the attachment.
the HTML code:
Code:
<html>
<head>
</head>
<body>
<script type="text/javascript">
var xmlDoc=null;
if (window.ActiveXObject)
{// code for IE
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
else if (document.implementation.createDocument)
{// code for Mozilla, Firefox, Opera, etc.
xmlDoc=document.implementation.createDocument("","",null);
}
else
{
alert('Your browser cannot handle this script');
}
if (xmlDoc!=null)
{
xmlDoc.async=false;
xmlDoc.load("data.xml");
var x=xmlDoc.getElementsByTagName("num");
document.write("<table border='1'>");
document.write("<thead>");
document.write("<tr><th>Reading(10 seconds)</th><th>temp</th><th>light</th></tr>");
document.write("</thead>");
for (var i=0;i<x.length;i++)
{
var w=i+1
document.write("<tr>");
document.write("<td>");
document.write([w]);
document.write("</td>");
document.write("<td>");
document.write(x[i].getElementsByTagName("temp")[0].childNodes[0].nodeValue);
document.write("</td>");
document.write("</tr>");
}
document.write("</table>");
}
</script>
</body>
</html>
Email now sent, the AHK script restarts the Eltima Data Logging program, using the same filename as it was originally, "data.txt".
And so the cycle continues - will be set to email once every hour or upon significant change.
The reason for the keyboard encoder was to allow the AXE090 with an 18X running the show to respond to any data/variable changes (because I'm unable to do it in VB)...
There's only temp on there at the minute but future improvements will be the addition of a PIR sensor in the kitchen, to use in conjunction with a webcam and have the script email a picture when anything changes/moves (scripts available on searching AutoHotKey).
Also a smoke detector... "Email >>>> from: "me" to: "me too" subject: "House on fire!!!" --- Doh!!! no good if im in manchester i guess but surprises like that are never good, who knows but its better to know, bad news travels at the speed of email in this case
Will also use the AHK script to autocomplete one of the free SMS websites and send a txt message.
Below is the Picaxe code, previously posted, for the 433tx/rx data logger - sorry no pics in project boxes - so i aint posting
Rx code: the crude time counter doesn't matter for now, will get accurate when my birthday order with Rev-ed is delivered.
Code:
init:
pause 10000 'used this to give me time to switch apps and start the Eltima - data logging program
' freeware RS232 data logger - http://www.eltima.com/products/rs232-data-logger/
sertxd(60,"xml_dl>",13,10)
symbol flash = 50
symbol ok_led = 0
main:
for w0=1 to 365
for b2=0 to 23
for b3 = 0 to 59
for b4 = 0 to 5
high ok_led
b5=b4*10
w4=w4+1
pause 9120 'wait ten seconds
serin 2,N2400,("data"),b6,b7
low ok_led 'special effects
let b6=b6-3
sertxd(60,"num",62,#w4,13,10)
sertxd(60,"time",62,#b2,":",#b3,":",#b5,60,47,"time",62,13,10)
sertxd(60,"day",62,#w0,60,47,"day",62,13,10)
sertxd(60,"temp",62,#b6,60,47,"temp",62,13,10)
sertxd(60,47,"num",62)
sertxd(13,10,13,10)
next b4
next b3
next b2
next w0
goto main
Tx code:
Code:
Main:
readtemp 5,b0
serout 1,N2400,(0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55) ' preamble to lock link the tx/rx
pause 5 // lock link and preamble solution by wolfgang ;0) cheers
serout 1,N2400,("data",b0)
pause 1000
goto main
I think that's it.. I just need to find a way to connect/interface the encoder with the picaxe so that it sends the required "1" character - if anyone has any ideas on how to do this please let me know an I'll put you on my xmas card list - cheers