High Low problem

We built the easy robot as per the instructions at the Home page.  Programmed it etc, worked fine, very happy.  We used the example program where he rolls about using his IR sensor to avoid obstacles.  Then we got a little creative and added an LED.  Only problem is the command HIGH turns the LED off and the command LOW turns the LED on. The LED is plugged into the same set of pins as the servo is plugged.  Servo is on pins 0, LED is on pins 2.  High 4, High 5 operate the motors normally.  We're a little confused as we imagine the pins to always be powered down until you command HIGH which puts a current through the pins. Have I got this wrong? Many thanks.

It depends on how you have

It depends on how you have your LED hooked up. LEDs are directional, so it matters which way you have it connected. You also need a current limiting resistor inline with the LED. If you are using the yellow resistor pack shown in the start here robot, you should be OK there.

Take a look at the two circuits below. ‘Ground’ is the ground connection and ‘V’ is the connection to the V1 or V2 power rail on your Picaxe project board.

The LED is represented by the >| symbol. The current will from from high to low in the direction of the arrow. It will not flow the opposite way, although if you put enough voltage and current across it the wrong way, it will blow!

Circuit 1:

Output Pin2       0-------[resistor]--------->|-------(Ground)

 

Circuit 2:

Output Pin2       0-------[resistor]---------|<-------(V)

Either circuit will work, but the will work differently. Circuit 1 will light the LED when Pin2 is set HIGH. Circuit 2 will light the LED when Pin2 is set LOW.

 

thanks

great I get it, and yes it works like i expect now, appreciate it!