go_away

Author Topic: 50$ Robot Status LED  (Read 2870 times)

0 Members and 1 Guest are viewing this topic.

Offline AZ196FTopic starter

  • Beginner
  • *
  • Posts: 2
  • Helpful? 0
50$ Robot Status LED
« on: June 05, 2007, 12:58:27 PM »
I'm looking at the code for the 50$ robot and wondering why turning port D4 off turns the LED on.  I think that if I could understand this, I might understand a lot more about i/o.

Offline razvanc_roro

  • Jr. Member
  • **
  • Posts: 41
  • Helpful? 0
Re: 50$ Robot Status LED
« Reply #1 on: June 05, 2007, 01:01:10 PM »
I understood that if you put D4 low, LED turns on. :)
Try do your best without doing anything! Possible?!?

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: 50$ Robot Status LED
« Reply #2 on: June 05, 2007, 01:10:21 PM »
When you wired up the LED, you have one end connected to + of the battery.

The other end is connected to D4.

So if D4 is also high (+), nothing will happen to the LED since both ends are + and +.

When you set D4 to low (-), you then have a voltage difference across the LED (+ and -), turning it on.


If you instead wired one LED end to ground (-), and the other to the D4 pin, when D4 goes high it is powering the LED - potentially bad. Its better to use the above method so that the battery directly powers the LED and not the microcontroller.

Offline AZ196FTopic starter

  • Beginner
  • *
  • Posts: 2
  • Helpful? 0
Re: 50$ Robot Status LED
« Reply #3 on: June 05, 2007, 01:12:04 PM »
Thank you, that's exactly what I needed to know!  Much Thanks!

 


Get Your Ad Here

data_list