That helps. As stated earlier, I am posting my current version of a working program. There are two objects, S2k Main, and Phone Handler. This isn't done yet,
and there are some things that I know of that need to be fine tuned. Critique at will, but be gentle.
Most of what's in the main object is there for testing purposes to see if I could get the two objects to communicate.
The main object, when done, will mostly monitor the car's alarm status, and to see if there is an incoming call on the cell.
{{S2k Main Ver 0.1 Main object for S2k Remote using cell phone. Ver 0.1}}
CON_clkmode = xtal1 + pll16x_xinfreq = 5_000_000VARLong Locked, Command
OBJ
phone : "Phone Handler"
pst : "Parallax Serial Terminal"PUBMain
pst.Start(115_200)
pst.clear
phone.Start
repeat
Locked := phone.LockStatus
Command := phone.CommandInput
pst.dec(Locked)
pst.char(",")
pst.dec(Command)
waitcnt(clkfreq + cnt)
if Locked == 0
Flash
pst.clear
PUBFlashrepeat2OUTa[noparse][[/noparse] 5 ]~~
waitcnt(clkfreq/30 + cnt)
OUTa[noparse][[/noparse] 5 ]~
Second object...
{{Phone Handler, Ver 0.6 Sub-Object to S2k Main
Works with no delay in the scan method; moved delay to the 2 check
methods. Works well when called from iPhone. }}
CON_clkmode = xtal1 + pll16x_xinfreq = 5_000_000
Pin_1 = 1'Pin code to enter: 1234, then #, which == 12,
Pin_2 = 2'to unLock system. Out of order entry Resets Count
Pin_3 = 3'variable to zero.
Pin_4 = 4VARlong stack[noparse][[/noparse]75]
long Num, Lock, Count, Command_Input
byte Cog
PUBStart : Successcognew(Scan, @stack)
DIRa[noparse][[/noparse]0..4]~
Lock := 1PRIScanrepeatifINaCase Lock
1: Check_PIN
0: Command
PRICheck_PIN
Num := INa[noparse][[/noparse]3..0]
waitcnt(clkfreq/4 + cnt)
case Count
0: if Num == Pin_1
Count += 1return1: if Num == Pin_2
Count += 1return2: if Num == Pin_3
Count += 1return3: if Num == Pin_4
Count += 1returncase Num
12: if Lock == 1AND Count == 4
Lock := 0
Count := 0PRICommand | flag
Num := INa[noparse][[/noparse]3..0]
waitcnt(clkfreq/4 + cnt)
case Num
11: flag := 11: if flag == 1
Command_Input := 1
flag := 02: if flag == 1
Command_Input := 2
flag := 03: if flag == 1
Command_Input := 3
Lock := 1
flag := 0PUBLockStatus : Status
Status := Lock
PUBCommandInput : Status
Status := Command_Input
This does work. I'm working on getting the propeller to somehow push the buttons on my key fob remote control for the car. I may have it figured out.
Thanks for any help = Dan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"She may not be very pretty now, but she was somebody's baby once." Bugs Bunny
What's the Flash method supposed to do? You never set any outputs in dira. Also, in the phone handler start method the dira setup affects the caller cog's I/O, not the one of the cog you start (which is what is most likely intended). As the default is all inputs anyway this doesn't matter right now.
OOOps, that somehow got deleted.
The flash is nothing more than a way to SEE that the lock variable was transfered to the Main object, and that it is unlocked.
When this is done, that won't be there. No need to flash a LED at that point.
I'm near success at connecting this to my car's alarm control key fob, and the propeller will take the incoming command and 'press' the appropriate button on the fob.
I'm using the key fob in leu of hardwiring because it's easier, and it keeps things stock in the car. The only hardwired element will be the kill command--cut off the fuel
pump, or something similar.
Dan := Thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"She may not be very pretty now, but she was somebody's baby once." Bugs Bunny
Comments
That helps. As stated earlier, I am posting my current version of a working program. There are two objects, S2k Main, and Phone Handler. This isn't done yet,
and there are some things that I know of that need to be fine tuned. Critique at will, but be gentle.
Most of what's in the main object is there for testing purposes to see if I could get the two objects to communicate.
The main object, when done, will mostly monitor the car's alarm status, and to see if there is an incoming call on the cell.
{{S2k Main Ver 0.1 Main object for S2k Remote using cell phone. Ver 0.1}} CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 VAR Long Locked, Command OBJ phone : "Phone Handler" pst : "Parallax Serial Terminal" PUB Main pst.Start(115_200) pst.clear phone.Start repeat Locked := phone.LockStatus Command := phone.CommandInput pst.dec(Locked) pst.char(",") pst.dec(Command) waitcnt(clkfreq + cnt) if Locked == 0 Flash pst.clear PUB Flash repeat 2 OUTa[noparse][[/noparse] 5 ]~~ waitcnt(clkfreq/30 + cnt) OUTa[noparse][[/noparse] 5 ]~
Second object...
{{Phone Handler, Ver 0.6 Sub-Object to S2k Main Works with no delay in the scan method; moved delay to the 2 check methods. Works well when called from iPhone. }} CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 Pin_1 = 1 'Pin code to enter: 1234, then #, which == 12, Pin_2 = 2 'to unLock system. Out of order entry Resets Count Pin_3 = 3 'variable to zero. Pin_4 = 4 VAR long stack[noparse][[/noparse]75] long Num, Lock, Count, Command_Input byte Cog PUB Start : Success cognew(Scan, @stack) DIRa[noparse][[/noparse]0..4]~ Lock := 1 PRI Scan repeat if INa Case Lock 1: Check_PIN 0: Command PRI Check_PIN Num := INa[noparse][[/noparse]3..0] waitcnt(clkfreq/4 + cnt) case Count 0: if Num == Pin_1 Count += 1 return 1: if Num == Pin_2 Count += 1 return 2: if Num == Pin_3 Count += 1 return 3: if Num == Pin_4 Count += 1 return case Num 12: if Lock == 1 AND Count == 4 Lock := 0 Count := 0 PRI Command | flag Num := INa[noparse][[/noparse]3..0] waitcnt(clkfreq/4 + cnt) case Num 11: flag := 1 1: if flag == 1 Command_Input := 1 flag := 0 2: if flag == 1 Command_Input := 2 flag := 0 3: if flag == 1 Command_Input := 3 Lock := 1 flag := 0 PUB LockStatus : Status Status := Lock PUB CommandInput : Status Status := Command_Input
This does work. I'm working on getting the propeller to somehow push the buttons on my key fob remote control for the car. I may have it figured out.
Thanks for any help = Dan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"She may not be very pretty now, but she was somebody's baby once." Bugs Bunny
Post Edited (iQuit) : 4/24/2010 3:49:58 AM GMT
Post Edited (kuroneko) : 4/24/2010 3:44:33 AM GMT
The flash is nothing more than a way to SEE that the lock variable was transfered to the Main object, and that it is unlocked.
When this is done, that won't be there. No need to flash a LED at that point.
I'm near success at connecting this to my car's alarm control key fob, and the propeller will take the incoming command and 'press' the appropriate button on the fob.
I'm using the key fob in leu of hardwiring because it's easier, and it keeps things stock in the car. The only hardwired element will be the kill command--cut off the fuel
pump, or something similar.
Dan := Thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"She may not be very pretty now, but she was somebody's baby once." Bugs Bunny
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"She may not be very pretty now, but she was somebody's baby once." Bugs Bunny
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
· Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz