Jump to content

Recommended Posts

Posted

EDIT: now that i have gotten it working i figured id replace the Original post with an explanation of how to use it.

First create an iron door and connect it to the White cable from an IO expander.

you need to connect two computers to this io expander 1 for each side of the door.

hide the processor and floppy drives in the wall so no one can reset your computer and have the monitors visible for typing in the password.

setting up the computer:

first you need to set up some commands to control your variables, type:

---------------

: STRING

32 ALLOT

SWAP

!

;

: SET

@ 32 CR ." : " ACCEPT

CR

;

: PRINT

@ CR ." '" TYPE ."'"

CR

;

------------------

(dont type the ----)

Next set up your variables :

-----------------

VARIABLE PASSWORD

PASSWORD STRING

VARIABLE TEMP

TEMP STRING

----------------

next you set up your password:

use

PASSWORD SET

it will then wait for you to type in the password.

you can use

PASSWORD PRINT

to check what your password is.

Next you write the lock program

( Thanks again to MasterVentris for getting this working)

---------

: LOCK

3 IOXADDR !

BEGIN

DO

PAGE

." Password : " CR

TEMP SET

PASSWORD @

TEMP @

STRCMP

0

= IF

PAGE

CR CR ." Access Granted "

1 IOX!

80 TICKS

0 IOX!

ELSE

PAGE

CR CR ." Access Denied! "

80 TICKS

THEN

LOOP

;

---------

Now that its set up youll want to save it so you can load it into the other computer.

Put in a blank floppy and type:

--------

SAVE" PASSDOOR V 1.1 by linaru

--------

that will save the lock to the floppy.

check your password is right with PASSWORD PRINT and PASSWORD SET

then type

------

LOCK

------

the monitor will now display the 'enter password screen'

when the correct password is typed in the door will open.

Finally.. insert your floppy disk into the second computer.

Set the password again and type LOCK again

the second Computer will let you type the password in from the other side of your door.

Once LOCK is typed in there is no way to get back to the normal typey in mode without resetting your computer via the processor. this will wipe the lock program so make sure you put your Floppy in a Safe place in case you need to set it up again.

and of course you could hook this up to anything with an on / off function.. password controlled piston bridge?

if you change the lock bit slightly :

---

change:

CR CR ." Access Denied! "

80 TICKS

THEN

LOOP

to

CR CR ." Access Denied! "

2 IOX!

70 TICKS

0 IOX!

THEN

LOOP

---

you can then attach an additional cable( 2 IOX! = orange i think) to the io expander and use it with a industrial craft alarm. This way the alarm goes off Every time some one gets the password wrong

Posted

both CC and WR are disabled on my server.

feels like i have been asking for help with a Linux computer and the reply's have been to get windows.

Posted

: LOCK

3 IOXADDR !

BEGIN

PAGE

." Password : " CR

TEMP SET

PASSWORD @

TEMP @

STRCMP

0

= IF

PAGE

CR CR ." Acess Granted "

1 IOX!

80 TICKS

0 IOX!

THEN

AGAIN

ELSE

PAGE

CR CR ." Acess Denied! "

80 TICKS

THEN

AGAIN

;

If I'm reading it right the code I have underlined is jumping back to PAGE before printing "Access Denied". Swap the lines over and it should work.

EDIT - Ignore this, looking up what PAGE actually means, as it is written before "access granted" which im assuming works.

EDIT 2 - Ah, so PAGE just clears the screen, obvious really. Where are you learning your FORTH code from? I think the problem is in the IF, as they follow the structure IF...ELSE...THEN; and your THEN AGAINs might be breaking it. This page might be of some help, assuming there aren't a load of FORTH versions and this is wrong- http://theforthsource.com/guide10.html

EDIT 3 - OK, so here is a possible solution:

: LOCK

3 IOXADDR !

BEGIN

DO

PAGE

." Password : " CR

TEMP SET

PASSWORD @

TEMP @

STRCMP

0

= IF

PAGE

CR CR ." Acess Granted "

1 IOX!

80 TICKS

0 IOX!

ELSE

PAGE

CR CR ." Acess Denied! "

80 TICKS

THEN

LOOP

;

I removed the THEN AGAIN commands and just threw the whole lot in a DO LOOP so it loops forever (I presume this machine only runs this lock). Certain syntax may have been omitted, semicolons etc., so you might need to tweak it to make it work. However, I think the general program is correct. Let me know.

Posted

(removed since its long)

I removed the THEN AGAIN commands and just threw the whole lot in a DO LOOP so it loops forever (I presume this machine only runs this lock). Certain syntax may have been omitted, semicolons etc., so you might need to tweak it to make it work. However, I think the general program is correct. Let me know.

I will try it out, actually got this from a tutorial video it was originally a code to lock the computer and when the password was correct it would exit the running program and allow you access again. but i have been adapting it for use with a door and obviously dont want people to be able to exit the program and type 1 IOX! to skip the password

EDIT:

i tested it out and it seems to work fine i have hooked up two redpower computers to an io expander and hidden the processors so only the monitor can be seen from either side of the door and copyed the program over to both of them using a floppy.

now Either monitor can be used to access the password screen and typing the correct password opens the door for a few seconds before resetting the whole thing.

thanks

  • 1 month later...
  • 6 months later...
Posted

ive followed all this, but when i type PASSWORD SET it comes up with 32 on the next line. is this suppost to happen? anyway i typed my password, and hit enter.but apon typing PASSWORD PRINT it says: "TYPA ." again, is this right?

thanks in advance :D

Posted

ive followed all this, but when i type PASSWORD SET it comes up with 32 on the next line. is this suppost to happen? anyway i typed my password, and hit enter.but apon typing PASSWORD PRINT it says: "TYPA ." again, is this right?

thanks in advance :D

well, it works, but when asking for password, it has 32 at the front of the line, this ment to be like this?

oh and great tutorial, only suggestion is that you put in how to write a variable for the noobs like me :P

Guest
This topic is now closed to further replies.
×
×
  • Create New...