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

Username:   Password: 
 RegisterRegister   
 Control problems with Turing.
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
HammadTheOne




PostPosted: Tue Jan 15, 2013 5:27 pm   Post subject: Control problems with Turing.

What is it you are trying to achieve?
I'm trying to make a circle move through commands from a joystick. The code is in place and joystick works, but I cannot make it work due to a couple of problems. The joystick has 5 different inputs, left, right, up down, and a push button.


What is the problem you are having?
For one, pin 10 is always high for me, even if the button is not being pressed. I tried taking out the joystick, pin 10 was still high. Another thing is that pin 13 also has problems turning on, and doesn't move the object.


Describe what you have tried to solve this problem
I've tried various attempts to fix this, I tried the mod 2 command, nothing happened, also I made a small program to check the inputs and outputs of the joystick to try and figure out what the problem was. I know that parallelget is what you need for this, but I just can't figure it out.

I also looked at this http://compsci.ca/holtsoft/doc/parallelget.html

Turing:


const val : int := parallelget
var pin10, pin12, pin13, pin11 : int

if pin10 = 1 then
    put ("Pin 10 is High")

end if

if pin12 = 1 then
    put ("Pin 12 is High")

end if

if pin13 = 1 then
    put ("Pin 13 is High")
end if

if pin11 = 1 then
    put ("Pin 11 is High")

end if




Please specify what version of Turing you are using
4.1.1



Joystick-Final.t
 Description:
Joystick commands implemented into final code. Doesn't work.

Download
 Filename:  Joystick-Final.t
 Filesize:  2.4 KB
 Downloaded:  46 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Tue Jan 15, 2013 5:54 pm   Post subject: RE:Control problems with Turing.

This doesn't seem right. Where does the value of pin10 get assigned to the variable?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
HammadTheOne




PostPosted: Tue Jan 15, 2013 6:03 pm   Post subject: Re: Control problems with Turing.

Sorry, here's the updated one. The same problem happens. pin10 := (val div 64). That should work. But I think since pin10 always ends up as 1 it may be replaying continuously.

Quote:
var pin10, pin12, pin13, pin11 : int
loop

const val:int := parallelget

pin11 := (val div 128)
pin10 := (val div 64)
pin12 := (val div 32)
pin13 := (val div 16)

if pin10 = 1 then
put ("Pin 10 is High")
delay (1000)
end if

if pin12 = 1 then
put ("Pin 12 is High")
delay (1000)
end if

if pin13 = 1 then
put ("Pin 13 is High")
delay (1000)
end if

if pin11 = 1 then
put ("Pin 11 is High")
delay (1000)
end if

end loop
Tony




PostPosted: Tue Jan 15, 2013 8:36 pm   Post subject: RE:Control problems with Turing.

parallelget
Quote:

put "Pin 10 is: ", (val div 64) mod 2
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: