Let's Make Robots!

Help with school project

Alright let me break this down quickly; i being the procrastinator that i am, (a very good one) left a project for the last minute (i.e. it should be due tommorw). I assume i can find most of this stuff in the manuals however i dont have enough time to test all the different circuits as well as design the aesthetic and written portion of my presentation. It will consist of a bunch of LEDs, maybe around 7 or so hooked up to the output pins 0-3 and im assuming the pins directly to the left or right depending on how you look at the board of the reset switch the only time i've coded for them was with the ping sensor so im assuming their coded with (high portc 0 to high portc 4) im assuming that will turn them on and off per pin assuming i need more than 7 ill figure the rest out. However the catch is that im using a momentary push button switch to toggle which LEDs i want turned on and which i want turned off. Its a basic momentary push button switch from radioshack with two connections which i assume are power and ground. I have absolutly* no experience coding with switches or for that matter connecting them with the 28x1 project board. For example,

high 0: high 1: high 3: high portc 1: high portc 4

 'now i push the switch, still not sure where its connected and now...

high 2: high 3: high 0: high portc 2: high portc 4 ' ect. maybe another two changes following this one

 

i want the LEDs to remain on until i push the switch once which will hopefully change them to the next set designated by the "high" pins. Once again im very sorry if these questions are in the manuals however i dont have the time at this moment to read through them or screw this up. (it was just a spontaneous thought i had) 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Connect 1 part of the switch to +voltage connect the other part of the switch to an input pin. Make sure you DO NOT put too much voltage in the switch and pay attention to normally open and closed for the switch if the switch can be wired either way. When the circuit is open or closed (depending on how it is wired) it will allow current to pass from + to input pin. Read the manual to see how much voltage is required to make the input register as high. Not only voltage but also amperage.
thanks again jklug, its says i need a 1k resistor between the 5V and the input pin, with an alternate 10k reistor to the ground
No do not do that. Stop connecting things now!! you just told your picaxe to turn on pin 0 (high 0) then you shorted out that pin to ground with your button. As soon as you hit the button, it is a direct short circuit. This is bad. Read first, connect second.

sorry back again, LEDs are working great however the switch is still causing me problems. I have one end of the switch in pin 0 with the other end connected into the hole where the additional header pins can be added (is this right?) with the intention of having in the code high 0 so that 0 is always outputting high. Therefore when i press the switch it should open the circuit allowing the input pin (the hole, or is it the pin thats already there?) so part of the main code is

high 0 ' pin one is always high

if 'if the input value is low, continue the routine

input pin0 = 1 'not sure if this is how you correctly code the input value but im trying to say if the input value is reading as high then goto blah

goto blah

 

sigh, coding is a pain. ill be checking the manuals in the mean time. 

hah i lied, manuals to the rescue

Off-da...

If pin0=1 then...

ah hah

 perhaps one day ill print out all the manuals and frame them on my wall, thanks. Crisis averted

When the switch is pushed it makes a input pin go high (have voltage). Make the code recognize when the input pin is high and have it light up whatever LEDs. When the input pin is low (no voltage) another set of LEDs is lit. The manual will tell you how to see if the input pin is high and how to make the LEDs light up. HINT: Don't light up all the leds at once you may not have enough voltage. Run them through a loop like so: (note code is sample code dont try to run it, I just wanted to get an idea across)

While input pin is high

LED1 HIGH
LED1 LOW
LED2 HIGH
LED2 LOW
...etc...

Wend

hm, so something like

high 0 ' pin 0 should always be turned on however the input value should be reading as low since the switch is stopping the current

if high 0 'if ever the read value of pin 0 is high, which should happen when the switch is hit, then go to whatever

goto 'watever

 

code could be completely wrong but theoretically it should look like that i would think. The only reason i want to do it this way and not the other is because i need to light the LEDs up differently more than twice (in order to recieve a good grade i hope, trying to show comparisions between charachters in a book) Im not so worried about the voltage as i can always hook up my second battery pack, this wouldnt be running for more than 3 minutes tops. 

I love ya, iCon... I really do but man-are you drunk?

First off, what the hell are you saying in that cluster-fuck of run-on sentance you call a post? Really, did you read through it after you wrote it?

Whew, I would love to help but really man, I have no idea what you want to do, have no idea what you need to know, have no idea peroid... Tell you what, re-ask some specific questions and we can probably help you. I do have to add to that, however, nothing beats the manual in terms of how to hook things up and code them -There are even pictures!