Computer Science Canada

turing and engineering assignment

Author:  brianrood [ Mon Jan 10, 2005 10:20 am ]
Post subject:  turing and engineering assignment

Hey, I have to do a final ISU for my computer engineering class, and I have to use turing and then using the parallel port and a breadboard I have to create something like working stop lights or a joystick or something of that sort, and I was wondering if anyone had any cool Ideas I could whip up quick or if n e 1 could direct me to a website with a bunch of ideas for projects, you can e-mail me , or reply here and I will check it.
Thanks,
brianrood

Author:  TheZsterBunny [ Mon Jan 10, 2005 8:32 pm ]
Post subject: 

Hrm. you could have a sort of 'bar meter' monitoring something

i haven't taken compeng, but maybe you could have a motor spinning, lights static around it, and the speed of the motor reflected by number of lights.

simpleish to do in turing (save the motor part -- no ideas), but the lights would look good there.


or you could speak to a tech teacher, dig up an old cannon project, and turn it into a 'fusion pulse laser cannon' by adding some leds to simulate charging and firing of the weapon. that could either be really cool or really cheezy.

good luck!

--edit--
heck, if you felt like it, you could do a binary clock. that'd be very cool.

-Z

Author:  scottyrush13 [ Mon Jan 10, 2005 10:20 pm ]
Post subject: 

a binary clock eh Thinking ? thats not a half bad idea

you should do it lol

sounds pretty neat

Author:  brianrood [ Mon Jan 10, 2005 11:54 pm ]
Post subject:  lateda, binary clock eh?

How would I go about doing a bimnary clock at all? Thats sounds totally messed up LoL.... and what would I use for outside just like a normal clock and make a turing program using binary numbers to keep with the time?

Author:  Tony [ Tue Jan 11, 2005 9:13 am ]
Post subject: 

Think Geek Laughing

Posted Image, might have been reduced in size. Click Image to view fullscreen.

Author:  brianrood [ Tue Jan 11, 2005 6:01 pm ]
Post subject:  thanks

Thank you very much I think I am going to try and get thios binary clock to work, I just need a piece of cardboard, and sum led's probably from your neighbourhood radio shack Lol... Thanks for the help,
Oh snap how would I go about doing the turing part? can someone start me off with a line or two or an explanation.. I am dumb..

Author:  Neo [ Tue Jan 11, 2005 6:12 pm ]
Post subject: 

For that you'll need to consult your teacher. If you made a circuit board Im sure he has told you how to turn on an led using turing. I think its the parallelput() command. IMO a binary clock sounds too simple and would be useless. Last year I made an etch-n-sketch machine controlled using a homemade joystick through turing... you can try that idea if you want?

Author:  josh [ Tue Jan 11, 2005 6:27 pm ]
Post subject: 

the turing commadns used for interfacing are:

code:

parallelput ()

and
code:

parallelget ()

inside of the brackets is the pin that you want to send the signal down or receive the signal from.

I have only done output interfacing programs but lets say I connected D0 (that is the first output pin, D is for data, they range from D0 - D7 giving you a totla of 8 unique paths)

and I want to send a signal down D0 to make the led connected to it light up, I would type:
code:

parallelput (1)


to stop all the signals I would use:
code:

parallelput (0)


bassically the data table looks like this:
code:

parallelput (0) kills signals
parallelput (1) sends down D0
parallelput (2) sends down D1
parallelput (4) sends down D2
parallelput ( 8 ) sends down D3
parallelput (16) sends down D4
parallelput (32) sends down D5
parallelput (64) sends down D6
parallelput (128) sends down D7


so if you wanted to send a signal down D0 and D1 you would use:
code:

paralleput (3)

because 1 + 2 is 3.

so basically you could display any 8 bit number just by typing the number in the brackets of parallelput, then connect each wire to a differnet LED, and it will display properly, now you just need a few rows to represent the different hours, minutes, and seconds and you just need to get the differnet hours, minutes, and seconds from the sytem clock.

The part I am not sure about is what you would do since their is only 8 output wires, you will have to get creative to figure out beause you will need more than 8 LED's.

EDIT: sorry, didn't see neo had already mentioned parallelput (), I was typing this when he posted.

Author:  TheZsterBunny [ Wed Jan 12, 2005 8:06 am ]
Post subject: 

neo,

do you mean you drew on the screen with the joystick?

that sounds about the same difficulty as the binary clock.

only, the bclock wouldn't be as flashy.

you'd kinda have to have some sort of cool turing component, right?

perhaps different clock modes? (i.e. 12/24/countdown/alarm)

ooh! how about tri-colored leds? green in morning, blue in day, and red at night?

-Z

Author:  Tony [ Wed Jan 12, 2005 9:31 am ]
Post subject: 

different colour leds are not that good of an idea since he'll be presenting it for 5 minutes tops during his class... nobody is going to wait for 12 hours to see the clock do what it does in a different colour..

the countdown mode sounds interesting enough. Especially if you time it right (such as count 1/10th of a second or something) to have a nice LED animation going

Author:  TheZsterBunny [ Wed Jan 12, 2005 11:51 am ]
Post subject: 

1 /10?

binary!

1/8th of a second.

Smile

-Z

Author:  Tony [ Wed Jan 12, 2005 1:19 pm ]
Post subject: 

details Rolling Eyes
but yes, 1/8th makes more sence

Author:  brianrood [ Tue Jan 18, 2005 10:01 pm ]
Post subject:  ok got project now sum turing help...

Ok, thanks for everything so far guys, I figured after some time I needed some chip a parallel chip my teacher did not have so we scrapped the binary clock, and now I am just going to be simple and make a stop light. I got creative and went and bought one of those cool stoplight lights and glow in different patterns and I unwired it all and took off the power cord so I am left with the three lights and the wires to them... I was wondering how I would do the coding I had the idea of using this:
var Green : int := 1
var Yellow : int := 2
var Red : int := 4
parallelput (Green)
loop
if parallelput (Green) then
delay (10000) and parallelput (Yellow)
end if
if parallelput (Yellow) then
delay (4000) and parallelput (Red)
end if
if parallelput (Red) then
delay (10000) and parallelput (Green)
end if
end loop

what am I doing wrong, and how could this be improved other then maiing it a big if statement with elsif's....???

Author:  josh [ Wed Jan 19, 2005 12:01 am ]
Post subject: 

first please use code or syntac tags nect time you post.

I don't think that your if's will work becuaese I am don't think it will recognize if parallelput (green).

what you need ot do is make another variable for the status and have that change depending on the light, something like this:

code:

var Green : int := 1
var Yellow : int := 2
var Red : int := 4
var status : string

parallelput (Green)
status := green
loop
   if status = green then
      delay (10000)
      parallelput (Yellow)
      status := yellow
   elsif status = yellow then
        delay (4000)
        parallelput (Red)
        status := red
  elsif status = red then
     delay (10000)
     parallelput (Green)
     status := green
     end if
end loop



so this way the if is dependant on the status variable and not on detecting what it is parallelputing,

Give that a try and if it does not work tell me adn i will try and fix it

Author:  brianrood [ Wed Jan 19, 2005 12:03 am ]
Post subject: 

ok thanks for that, I will try it tomorrow and I will get back to you, and I have no life so I can reply right after you responded LoL, thanks a lot though man..

Author:  josh [ Wed Jan 19, 2005 12:04 am ]
Post subject: 

no problem, always happy to help a fellow engineering person, I just got home from work but I think I will go to bed now.

Author:  brianrood [ Sun Jan 23, 2005 4:12 pm ]
Post subject:  HELP BY SUNDAY NIGHT PLEASE!!!

Ok, I am doing the stoplight, and I want to have a picture of a car driving upto the stoplight and depending on whether the light is green or yellow or red if it goes through it or stops, and waits, I am using the code above plus some added road and stuff, the stoplight road y value is 200. and what code I need to do to get the picture of my car to animate. The file of it is C:\My Documents\My Pictures\beamer.JPEG. Do I have to use a Pic.Draw command or something? Could someone take a few minutes and throw me the coding for this.

Thanks,
Brian

Author:  josh [ Sun Jan 23, 2005 4:25 pm ]
Post subject: 

you need to use Pic.Screenload so you can keep loading the pic at the new coordinates. You can then have it so that when the light changes a variable is given a different value. depending on the value of the variable make the car move or not move using if statements.

try doing something yourself and if it does not work out tell me and I will -post some code to help you out.

Author:  TheXploder [ Sun Jan 23, 2005 4:44 pm ]
Post subject: 

What I did last year was, I modded the remote of a remote controlled tank to be controlled by the keyboard. So I could connect the remote control to the printer port and using truing I could send commands to the remote. Turned out licely and it even drew where the tank had traveled, but not to exact.

Author:  brianrood [ Sun Jan 23, 2005 5:10 pm ]
Post subject:  Here is what I got

code:

%January 20th 2005
%ISU on traffic light
View.Set ("graphics:640;480")
var Green : int := 1
var Yellow : int := 2
var Red : int := 4
var status : int
%drawing the scene
View.Set ("graphics:640;480")

drawfillbox (0, 0, 640, 480, green)

%Road going Vertical
drawfillbox (250, 0, 390, 480, grey)
drawfillbox (315, 0, 325, 20, yellow)
drawfillbox (315, 30, 325, 50, yellow)
drawfillbox (315, 60, 325, 80, yellow)
drawfillbox (315, 90, 325, 110, yellow)
drawfillbox (315, 120, 325, 140, yellow)
drawfillbox (315, 150, 325, 170, yellow)
drawfillbox (315, 180, 325, 200, yellow)
drawfillbox (315, 300, 325, 320, yellow)
drawfillbox (315, 330, 325, 350, yellow)
drawfillbox (315, 360, 325, 380, yellow)
drawfillbox (315, 390, 325, 410, yellow)
drawfillbox (315, 420, 325, 440, yellow)
drawfillbox (315, 450, 325, 470, yellow)
%Road going horizontal
drawfillbox (0, 300, 640, 200, grey)
drawfillbox (0, 247, 20, 253, yellow)
drawfillbox (30, 247, 50, 253, yellow)
drawfillbox (60, 247, 80, 253, yellow)
drawfillbox (90, 247, 110, 253, yellow)
drawfillbox (120, 247, 150, 253, yellow)
drawfillbox (160, 247, 180, 253, yellow)
drawfillbox (190, 247, 210, 253, yellow)
drawfillbox (220, 247, 240, 253, yellow)
drawfillbox (390, 247, 410, 253, yellow)
drawfillbox (420, 247, 440, 253, yellow)
drawfillbox (450, 247, 470, 253, yellow)
drawfillbox (480, 247, 500, 253, yellow)
drawfillbox (510, 247, 530, 253, yellow)
drawfillbox (540, 247, 560, 253, yellow)
drawfillbox (570, 247, 590, 253, yellow)
drawfillbox (600, 247, 620, 253, yellow)
drawfillbox (630, 247, 650, 253, yellow)
%stoplight pole
drawfillbox (550, 300, 570, 305, black)
drawfillbox (555, 300, 565, 450, black)
drawfilloval (560, 450, 6, 6, black)
drawfillbox (555, 445, 470, 450, black)
drawfillbox (470, 445, 475, 430, black)
%parallelput (Green)
status := Green
loop
    %stop light
    drawfillbox (450, 340, 495, 430, 43)
    %Green light
    drawfilloval (473, 360, 10, 10, black)
    %Yellow Light
    drawfilloval (473, 385, 10, 10, black)
    %Red Light
    drawfilloval (473, 410, 10, 10, black)
    %Car
    Pic.ScreenLoad ("beamer.JPG", 310, 10, picCopy)
    %statements on changing lights
    if status = Green then
        drawfilloval (473, 360, 10, 10, green)
        delay (5000)
        parallelput (Yellow)
        status := Yellow
        drawfilloval (473, 385, 10, 10, Yellow)
    elsif status = Yellow then
        delay (2000)
        parallelput (Red)
        status := Red
        drawfilloval (473, 410, 10, 10, Red)
    elsif status = Red then
        delay (5000)
        parallelput (Green)
        status := Green
        drawfilloval (473, 360, 10, 10, Green)
    end if
end loop


Can you tell me what is wrong with the car pic? I can get it to move, if I can get it on the screen... Thanks...

Author:  josh [ Sun Jan 23, 2005 5:33 pm ]
Post subject: 

is the pic saved in the same directory as the turing file? becuase if it isn't then you need to put a copy of the pic into the folder where the turing file is or you need to type in the full file path in the "" of hte pic.screenload comand.

e.g.
code:

Pic.ScreenLoad ("C:/folder/anotherfolder/wherepicis/beemer.jpg",x,y,picCopy)

Author:  Leftover [ Sun Jan 23, 2005 5:34 pm ]
Post subject: 

I co-op taught a comp eng class last year. If you still need ideas, some of the ones we has last year were:

Stoplight (most common)

Dot Matrix Scrolling LED sign

3x16 LCD screen displaying animation

RC Car (one of those "popular" mini RC cars, he hooked the remote to the parallel port and put controlls and parallelput commands to control the car from the computer)

Many interactive games with buttons, parallelput and parallelget commands and LED's

Turning Parallel port into sound card by using turing, parallelput, and a speaker wired to a parallel port (played music using the composer in Turing)

And the last one I remember was a small car modded with the head lights and break lights to turn on depending on the direction the wheels (motors) were spinning.


: