Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Hardware Controll
Index -> Programming, Turing -> Turing Submissions
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
TheXploder




PostPosted: 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.

code:

var LampStatus : int := 0

loop
    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
    else
        loop
            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.
Sponsor
Sponsor
Sponsor
sponsor
octopi




PostPosted: Thu Mar 04, 2004 11:52 pm   Post subject: (No 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)
TheXploder




PostPosted: Fri Mar 05, 2004 5:03 pm   Post subject: (No subject)

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




PostPosted: Fri Mar 05, 2004 7:49 pm   Post subject: (No 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
7:
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
TheXploder




PostPosted: Fri Mar 05, 2004 7:56 pm   Post subject: (No subject)

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




PostPosted: Fri Mar 05, 2004 8:04 pm   Post subject: (No subject)

the_short1 - you got it wrong (well almost) Laughing

Colour/Digit
black 0
brown 1
red 2
orange 3
yellow 4
green 5
blue 6
violet 7
gray 8
white 9
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
the_short1




PostPosted: Fri Mar 05, 2004 8:07 pm   Post subject: (No 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???
zylum




PostPosted: Fri Mar 05, 2004 8:57 pm   Post subject: (No 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
Sponsor
Sponsor
Sponsor
sponsor
the_short1




PostPosted: Fri Mar 05, 2004 9:57 pm   Post subject: (No 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
TheXploder




PostPosted: Fri Mar 05, 2004 10:34 pm   Post subject: (No 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... :

code:

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

loop
    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...
jonos




PostPosted: Fri Mar 05, 2004 10:38 pm   Post subject: (No subject)

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

parallelput(number)
zylum




PostPosted: Sat Mar 06, 2004 12:01 am   Post subject: (No 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
Homer_simpson




PostPosted: Sat Mar 06, 2004 12:04 am   Post subject: (No 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...
jonos




PostPosted: Sat Mar 06, 2004 12:11 am   Post subject: (No 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?
zylum




PostPosted: Sat Mar 06, 2004 12:14 am   Post subject: (No 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.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 19 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: