Go to Post An inability to communicate your ideas effectively is a handicap you would be well served to strive to overcome. - Ether [more]
Home
Go Back   Chief Delphi > Technical > Technical Discussion
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 30-01-2002, 15:07
Madison's Avatar
Madison Madison is offline
Dancing through life...
FRC #0488 (Xbot)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1999
Location: Seattle, WA
Posts: 5,243
Madison has a reputation beyond reputeMadison has a reputation beyond reputeMadison has a reputation beyond reputeMadison has a reputation beyond reputeMadison has a reputation beyond reputeMadison has a reputation beyond reputeMadison has a reputation beyond reputeMadison has a reputation beyond reputeMadison has a reputation beyond reputeMadison has a reputation beyond reputeMadison has a reputation beyond repute
Non-variable Victor Control

Simple question for you all:

How can we program the RC to operate the Victor's with a toggle switch?

In other words, we want the speed controller to be on (255) when the switch is on, or off (127) when it's not.

Simple in concept, but our brain trust hasn't been able to make it work in practice.

Your help, as always, is appreciated.
__________________
--Madison--

...down at the Ozdust!

Like a grand and miraculous spaceship, our planet has sailed through the universe of time. And for a brief moment, we have been among its many passengers.
  #2   Spotlight this post!  
Unread 30-01-2002, 15:44
Unsung FIRST Hero
Matt Leese Matt Leese is offline
Been-In-FIRST-Too-Long
FRC #1438 (The Aztechs)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1998
Location: Long Beach, CA
Posts: 937
Matt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond repute
Send a message via AIM to Matt Leese
Assume you're using PWM7.

if button_pressed then toggleOn
PWM7 = 127
goto endToggle
toggleOn:
PWM7 = 254
endToggle

Make sure that you actually pass the PWM value through to the SerOut command (look at the sample for what to send). Also, make sure to limit the value to 254 and not 255. 255 is not a valid output value. The above is mostly in psuedocode but you should be able to figure the rest out.

Matt
  #3   Spotlight this post!  
Unread 30-01-2002, 16:18
Manoel's Avatar
Manoel Manoel is offline
Registered User
FRC #0383 (Brazilian Machine)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 2000
Location: Porto Alegre, RS, Brazil
Posts: 608
Manoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond repute
Send a message via ICQ to Manoel Send a message via MSN to Manoel
Try this:

Declare nice_motor as a variable byte
Then state that:
nice_motor = 127 + (127*button1) - (127*button2)

And of course, serout nice_motor to the desired PWM pin

What will happen:

If button 1 is pressed, the motor will go full forward, if button 0 is pressed, it'll go full reverse, and if you press them both (who would do that? ), nothing happens.
__________________
Manoel Flores da Cunha
Mentor
Brazilian Machine
Team # 383
  #4   Spotlight this post!  
Unread 30-01-2002, 16:27
Ian W. Ian W. is offline
College? What?
no team (Gompei and the Herd)
Team Role: College Student
 
Join Date: Jan 2002
Rookie Year: 2002
Location: Worcester, MA | Smithtown, NY
Posts: 1,464
Ian W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to all
Send a message via AIM to Ian W.
Yay!

In case you can't tell, I'm on the same team as Micheal. I'm the main programmer, and I have to say, THANK YOU!!!! Now, we can do something that we think is pretty cool, and we can use cool toggle switches too . If you guys are going to the L.I, N.Y.C., or nationals, you'll see why we need the toggle switch controlled pwms. Other than that, if I say anything else, my team members will kill me. So, once again, thanks a whole lot, and good luck to all!
  #5   Spotlight this post!  
Unread 30-01-2002, 16:29
Ian W. Ian W. is offline
College? What?
no team (Gompei and the Herd)
Team Role: College Student
 
Join Date: Jan 2002
Rookie Year: 2002
Location: Worcester, MA | Smithtown, NY
Posts: 1,464
Ian W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to all
Send a message via AIM to Ian W.
?

Well, I understood the nice little if statement one (by matt), but the second one makes no sense to me. Sorry if I sound mean, but this is my first year doing PBASIC, and I want to keep it simple. We tried the first solution, and it worked. When we tried to make it work before, we set it to switch the pwm to 255, where as it can only go to 254 (thanks matt). So, end result, problem fixed, controllers of team #810 happy.
  #6   Spotlight this post!  
Unread 30-01-2002, 17:43
Joseph F Joseph F is offline
Registered User
#0506 (Steel Friars)
 
Join Date: Jan 2002
Location: New York
Posts: 59
Joseph F is an unknown quantity at this point
Send a message via AIM to Joseph F
would the following make it so you didnt have to edit the serout?

(assume victor is connected to the port for p4_wheel)

if fswitch = 1 goto move
p4_wheel = 127
goto nomove
move:
p4_wheel = 256
nomove:

also would this work better/worse if there was/wasn't a joystick plugged into port 4?
__________________
One Team, One Bot, One Fleet of Ambulances!
  #7   Spotlight this post!  
Unread 30-01-2002, 18:18
Ian W. Ian W. is offline
College? What?
no team (Gompei and the Herd)
Team Role: College Student
 
Join Date: Jan 2002
Rookie Year: 2002
Location: Worcester, MA | Smithtown, NY
Posts: 1,464
Ian W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to all
Send a message via AIM to Ian W.
Well, I made it work using Matt's solution, mostly because that's the simplest (to me at least), because this is the first year I've ever used PBASIC before. I'm surprising myself with how well I already know it (I'm currently the team 810 PBASIC Guru, so t speak), but I still want to keep the program simple.

Another reason why it's easy to keep simple, the motors only have to go foward and off, they don't need to be reversed. This might give a clue to some of you what we're doing, but I'm not telling . If you want to see the secret, you'll have to wait until the L.I. regional. Once again, thanks for all the help. This is one of the best forums I've ever been to, I get a response so fast.
  #8   Spotlight this post!  
Unread 30-01-2002, 18:57
Unsung FIRST Hero
Matt Leese Matt Leese is offline
Been-In-FIRST-Too-Long
FRC #1438 (The Aztechs)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1998
Location: Long Beach, CA
Posts: 937
Matt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond repute
Send a message via AIM to Matt Leese
Re: would the following make it so you didnt have to edit the serout?

Quote:
Originally posted by Joseph F
(assume victor is connected to the port for p4_wheel)

if fswitch = 1 goto move
p4_wheel = 127
goto nomove
move:
p4_wheel = 256
nomove:

also would this work better/worse if there was/wasn't a joystick plugged into port 4?
Don't use 256! 256 is equivalent to 0 (the byte will wrap around to zero).

Matt
  #9   Spotlight this post!  
Unread 30-01-2002, 19:07
Ian W. Ian W. is offline
College? What?
no team (Gompei and the Herd)
Team Role: College Student
 
Join Date: Jan 2002
Rookie Year: 2002
Location: Worcester, MA | Smithtown, NY
Posts: 1,464
Ian W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to all
Send a message via AIM to Ian W.
Don't worry, I'm not using 256. Someone told me it resets the RC, so I've stayed away from it always. 255 I thought was full power, although I guess I'm wrong. Oh well, learn from your mistakes.
  #10   Spotlight this post!  
Unread 30-01-2002, 20:26
Kai Zhao Kai Zhao is offline
Registered User
#0686 (Bovine Intervention)
 
Join Date: Nov 2001
Location: Frederick, MD
Posts: 28
Kai Zhao is on a distinguished road
Send a message via AIM to Kai Zhao
Quote:
Originally posted by Ian W.
Don't worry, I'm not using 256. Someone told me it resets the RC, so I've stayed away from it always. 255 I thought was full power, although I guess I'm wrong. Oh well, learn from your mistakes.
Never use 255. IIRC, two 255's sent in a row is the Main CPU reset signal or something malicious of the kind. Use 254.

Not like it matters anyway. 218 (?) to 254 is all full power, if I remember. And 0 - 36 (?) is all full power. I'm not too sure about the exact values and its something that Dr. Joe would know.
  #11   Spotlight this post!  
Unread 30-01-2002, 21:05
Ian W. Ian W. is offline
College? What?
no team (Gompei and the Herd)
Team Role: College Student
 
Join Date: Jan 2002
Rookie Year: 2002
Location: Worcester, MA | Smithtown, NY
Posts: 1,464
Ian W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to all
Send a message via AIM to Ian W.
Really? I did not know that. I thought a number of 256 would reset the uP. Hmm, maybe that's why our relays flipped out when we flipped the switch. Oh well, no damage done (I hope). Thanks for all the help, cause now our little sercret works.
  #12   Spotlight this post!  
Unread 30-01-2002, 22:13
Joseph F Joseph F is offline
Registered User
#0506 (Steel Friars)
 
Join Date: Jan 2002
Location: New York
Posts: 59
Joseph F is an unknown quantity at this point
Send a message via AIM to Joseph F
Re: Re: would the following make it so you didnt have to edit the serout?

Quote:
Originally posted by Matt Leese

Don't use 256! 256 is equivalent to 0 (the byte will wrap around to zero).

Matt
I meant to say 254. It's been a long day and I havn't downloaded any sleep lately. With that same code but a 254 instead of a 256 would it work without serout editing? would it work better/worse/not at all if a joystick was/wasn't attached to the port
__________________
One Team, One Bot, One Fleet of Ambulances!
  #13   Spotlight this post!  
Unread 30-01-2002, 22:29
Manoel's Avatar
Manoel Manoel is offline
Registered User
FRC #0383 (Brazilian Machine)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 2000
Location: Porto Alegre, RS, Brazil
Posts: 608
Manoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond repute
Send a message via ICQ to Manoel Send a message via MSN to Manoel
Quote:
Originally posted by Ian W.
Another reason why it's easy to keep simple, the motors only have to go foward and off, they don't need to be reversed.
Then simplify the formula to

nice_motor = 127 + (button * 127)

__________________
Manoel Flores da Cunha
Mentor
Brazilian Machine
Team # 383
  #14   Spotlight this post!  
Unread 30-01-2002, 22:57
Joe Johnson's Avatar Unsung FIRST Hero
Joe Johnson Joe Johnson is offline
Engineer at Medrobotics
AKA: Dr. Joe
FRC #0088 (TJ2)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1996
Location: Raynham, MA
Posts: 2,633
Joe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond repute
You guys bring tears to my eyes! ;-)

Wow! That was great!

The question was posted at 3:00 and by 11:00 we are all a lot smarter.

This is why I love these forums.

Well done, FIRST online folks.

Keep up the good work.

Joe J.
  #15   Spotlight this post!  
Unread 31-01-2002, 15:17
Ian W. Ian W. is offline
College? What?
no team (Gompei and the Herd)
Team Role: College Student
 
Join Date: Jan 2002
Rookie Year: 2002
Location: Worcester, MA | Smithtown, NY
Posts: 1,464
Ian W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to all
Send a message via AIM to Ian W.
Yes, I have to agree with Joe. I've pretty much self-taught myself PBASIC over the past two or three weeks. Yeah, it's a bit late to be learning it, but someone else who was supposed to do the programming dropped out. But me and my friend looked through the default code, learned literally every line of that (took about an hour or two), and after that went on to alter the code to our needs. So far, it hasn't been that hard, the math is kind of annoying though. But the coolest thing is that whenever I have a problem, I can just come here and I have an answer right away. Yay for online forums! Now I just wish my team's forums were as active...
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
variable? manodrum Programming 11 01-04-2003 17:20
Coupling the Chiaphua & a variable Drill output Jeff Sharpe Motors 9 13-01-2003 20:21
Variable Amperage in DC Circuit. How? Jordan A. Electrical 4 01-11-2002 20:26
Dashboard programs and the char variable Ian W. Programming 13 26-06-2002 02:07
what teams have a variable transmissions? Greg Perkins Technical Discussion 4 06-03-2002 06:10


All times are GMT -5. The time now is 23:17.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi