Computer Science Canada

Hardware Controll

Author:  TheXploder [ Thu Mar 04, 2004 11:22 pm ]
Post subject:  Hardware Controll

I made a small programm from where you can controll a lamp.
I linked it through the printer port.


var LampStatus : int := 0

    get LampStatus

    if LampStatus <= 1 then
        if LampStatus = 0 then
            locate (1, 1)
            put "Lamp: OFF"
        elsif LampStatus = 1 then
            locate (1, 1)
            put "Lamp: ON"
        end if
            get LampStatus
            if LampStatus = 0 then
                locate (1, 1)
                put "Lamp: OFF"
            elsif LampStatus = 1 then
                locate (1, 1)
                put "Lamp: ON"
            end if
            exit when LampStatus < 2
        end loop
        PC.ParallelPut (1, LampStatus)
    end if

    PC.ParallelPut (1, LampStatus)
end loop

Does anyone have a tutorial on this? thanx

PS: Don't try to use this if you dont have it attached to the printer port.

Author:  octopi [ Thu Mar 04, 2004 11:52 pm ]
Post subject: 

by lamp, he means LED, or similar low voltage light source.

Connect a LED to pin 2, and 18
It should light.

(Might be 9 & 18 though...something like that)

Author:  TheXploder [ Fri Mar 05, 2004 5:03 pm ]
Post subject: 

yeah.. I used a LED and a resistor...

Author:  the_short1 [ Fri Mar 05, 2004 7:49 pm ]
Post subject: 

wut colors on the resistor... i have a bunch kicking around...
i gota try this...and wut pins exactly did you use..,i dont want to screw nothing up with my PC

PS: i know the resistor color code... i belive this is what it is....

0: Black
1: Brown
2: Red
3: Purple
4: Yellow
5: Green
6: Blue
8: Gray
9: White
someone please tell me #7 and or the order of 7,8,9
i have it on paper somewhere but i dont want to dig it up

PSS: I took gr.10 electronics and passed with 92... Razz Razz Razz

made a strobe light, and a nerve tester

Author:  TheXploder [ Fri Mar 05, 2004 7:56 pm ]
Post subject: 

I used a 100ohm resistor, you can always check the resistance... I used pin 1 and pin 14...

Author:  Tony [ Fri Mar 05, 2004 8:04 pm ]
Post subject: 

the_short1 - you got it wrong (well almost) Laughing

black 0
brown 1
red 2
orange 3
yellow 4
green 5
blue 6
violet 7
gray 8
white 9

Author:  the_short1 [ Fri Mar 05, 2004 8:07 pm ]
Post subject: 

cool... Correction... i took gr.9 Electronics.. that was when i still was in BC.. not Ontario... (whcih is LAME... Korah here in Sault Saint Marie dont have electronics) anyways...

thx for informing me that tony... and that was fresh on your head on did you look on the net or something...

i used to have it 100 percent memorized
guess getting a little flaky...
anyways... xploder... what made you want to turn on a Light Emiting Diode out of the Printer port for???

Author:  zylum [ Fri Mar 05, 2004 8:57 pm ]
Post subject: 

i guess he took computer engineering... they teach you interfacing in that course... this year we made a remote control car for the final project programmed in turing... it was domb though cuz it had to be linked to the computer by a network cable

Author:  the_short1 [ Fri Mar 05, 2004 9:57 pm ]
Post subject: 

dude taht still would be so FRICKING dope... a remote(corded) control car, with controls in turing.... cool....

also you guys coulda got a wireless router and hooked it up??? though of that??? ..... yea i was thinking of taking a+ certification course here at Korah (gr.11) from Hewlett Packard for computer engineering... but i opted out and took Tech Design.... i can always take it in gr,12 tho.. heheheh

Author:  TheXploder [ Fri Mar 05, 2004 10:34 pm ]
Post subject: 

I never took any computer engeneering courses... Well ya, look your school and I myself had the same Idea, I got a $25 tank with a remote controller and moded the remote controller to attach to the printer port and I made this program now, I don't need a crappy controller, just my keyboard...muhahaha, go tank, go, take over the world, muhahah... :


var chars : array char of boolean

proc Action (move, turn : int)
    var updown : int := 0
    var leftright : int := 0
    if move = 1 then
        updown := 2
    elsif move = -1 then
        updown := 4
    end if
    if turn = 1 then
        leftright := 1
    elsif turn = -1 then
        leftright := 8
    end if
    PC.ParallelPut (1, 255 - leftright - updown)
end Action

    Input.KeyDown (chars)
    if chars (KEY_UP_ARROW) then
        Action (1, 0)
    end if
    if chars (KEY_RIGHT_ARROW) then
        Action (0, 1)
    end if
    if chars (KEY_LEFT_ARROW) then
        Action (0, -1)
    end if
    if chars (KEY_DOWN_ARROW) then
        Action (-1, 0)
    end if
end loop

PS: Actually to the printer port I connected a 18 pin connector which had wires leading up to a 14 port connector which in turn are connected to the remote controller, so yeah its pin 2 and pin 18 that you need to connect it to...

Author:  jonos [ Fri Mar 05, 2004 10:38 pm ]
Post subject: 

all that is wierd to me because in comp eng we just turned on leds and put the command:


Author:  zylum [ Sat Mar 06, 2004 12:01 am ]
Post subject: 

well yeah, thats what i did in grade 10... i had grade 11 comp eng last semester and thats when the good stuff happens lol

Author:  Homer_simpson [ Sat Mar 06, 2004 12:04 am ]
Post subject: 

man this shiz is givin me ideas on making a robot thingy! could use the webcam for eye... analyse picture or something... not in turing tho...

Author:  jonos [ Sat Mar 06, 2004 12:11 am ]
Post subject: 

for the sake of spamming now, wanna hear something funny. this guy tried to "port" or whatever his keyboard to serial, and he fried his motherboard. what an idiot. aren't they didn't bit rates?

Author:  zylum [ Sat Mar 06, 2004 12:14 am ]
Post subject: 

lol, you're supposed to use some chip (forgot which one) which only allows the electricity to flow in one direction and would prevent that sort of problem... and oh yeah a voltage regulator helps too.

Author:  octopi [ Sat Mar 06, 2004 1:53 am ]
Post subject: 

I think you mean a diode zylum
Diodes only allow electrons to flow in one direction.

Keyboards, and mice (PS/2) are serial devices. They work by sending there data serially (using a clock)
You could hook on up to a serial port..(thats what a serial to ps/2 convertor does)

I'm building a project right now that consists of an LED matrix
(5x7), and an atmel at90s2313 microcontroller, and a AT keyboard.

You push a letter on the keyboard, and it shows the led in the matrix.
Right now I'm waiting for my latest shipment to come in, and I'm also working on connecting the keyboard to the atmel, it should be pretty easy to do, I just don't have any time

Author:  the_short1 [ Sat Mar 06, 2004 1:08 pm ]
Post subject: 

you should take a picture of taht and post on compsci.... taht would look sweet.... waht color of LED's are you going to be using, and/or are they going to be SuperBright ones...(light bulb apears white, but color is different)

Author:  octopi [ Sat Mar 06, 2004 1:53 pm ]
Post subject: 

Um, since I'm not a crazy mofo.

I'm using one of these
So I don't have to wire millions of led's together

The above thing uses common anode coloumns and common cathode rows, you multiplex it to make an image. (Multiplexing is how a tv works, on a tv theres an electron gun shooting across the screen one pixel at a time, but it does it at such a fast rate that your eye sees it as one thing, due to 'persistance of vision')
Multiplexing a LED Matrix, basically consists of turning one coloumn on at a time, and then you also supply power to the row.


          A   B   C    D
       1  X
       3  X

If I wanted to turn those two leds on, I'd turn coloumn A on, and supply power to 1, and 3

Multiplexing basically just saves the number of IO lines you need on your microprocessor.

Author:  Jodo Yodo [ Sat Mar 06, 2004 10:14 pm ]
Post subject: 

Wow, that's really cool. I didn't know that Turing could manipulate the hardware.