User Controls

Why wont this work?

  1. #1
    SBTlauien African Astronaut
    I'm following this niggas tutorial right here and I can't get my LED to blink when I press the button. WTF?



    Here's the schematic...

  2. #2
    LiquidIce Houston
    Have you checked pins 27 and 28 with a multimeter to confirm there's current flowing? Just stick the multimeter to pins 27 and 28 and if there's current, maybe somethings fucked with cable/led/resistor. If there's no current, perhaps something is wrong with the code or the board itself.

    I know jack shit about electronics. Always wanted to get into this microcontroller stuff :(
  3. #3
    SBTlauien African Astronaut
    Always wanted to get into this microcontroller stuff :(

    It's very inexpensive. Here are the things you would need and the prices...

    Programmer = $35
    Breadboard = $25
    Different variety packs - resistors, capacitors, voltage regulators, switches, diodes, transistors, crystals @ $7 each = $48
    Wire = $2
    Wire Cutters = $25
    A couple few microcontrollers = $20

    So $155 and you just have to learn after that.

    Edit: a multimeter and solder iron would put you up near $200 if you didn't buy the best.
  4. #4
    LiquidIce Houston
    Yeah, I guess I'll hold off on this and mess around with the stuff I still got in my backlog. Do you have a mutlimeter? I remember I was fucking around with some stuff with a 4$ soldering iron and 10$ multimeter from dealextreme, but those are pretty much 1-2 use devices.

    Are you messing around with this as a hobby? Or you wanna build something? Friend of mine built this sensor that notified a RPi whether the bathroom door was open or closed so he would know if it was worth getting up from his desk to shit.
  5. #5
    SBTlauien African Astronaut
    Have you checked pins 27 and 28 with a multimeter to confirm there's current flowing?

    Well I probably should have just done that in the first place. When placing my multimeter on the resistor near the LED it's at 1.4mV, then after pressing the button I get a a jump but it's to fast to read. It's does display an 0.L but I just read that it's the multimeter rushing from mV to V.

    Here's the code for the program. I forgot to post...


    #define F_CPU 1000000UL
    #include <avr/io.h>
    #include <util/delay.h>

    void ioinit(void);
    void led_on(void);
    void led_off(void);

    int main(void) {
    ioinit(); //Setup IO pins and defaults
    while (1) {
    if (bit_is_clear(PINC, 4)) {
    for (int i = 0; i < 6; i++) {
    if (i > 0) {
    _delay_ms(500);
    led_on();
    _delay_ms(500);
    led_off();
    }
    }
    }
    }
    }

    void ioinit(void) {
    DDRC = 0b11101111; //Pin 27 of MCU as input
    PORTC = 0b00010000; //Enable internal pullup of pin 27
    }

    void led_on(void) {
    PORTC |= _BV(PC5); //Pin 28 of MCU as output
    }

    void led_off(void) {
    PORTC &= ~_BV(PC5);
    }
  6. #6
    LiquidIce Houston
    Not being a C-head, the code looks alright. Did you get any progress here? What might help here is to simplify the code to just turn the LED on and leave it on for like 20 seconds - giving you enough time to test things with the multimeter. Like, trying to simplify the situation as much as possible, then add back in the blinking and stuff.
  7. #7
    SBTlauien African Astronaut
    I haven't figured it out yet. I did change the code but it still wont turn the LED on. When I tested with my multimeter, I got nearly 5V on the part of the resistor that's near the LED, but nothing on the other side of the resistor. I tried changing out the resistor and trying different resistors, nothing worked. I'm not sure what to try next.
  8. #8
    SBTlauien African Astronaut
    In an all white slavic country full f angry violent men and little sex r available chicks whoa rent gold digger or want to be courteyed to like in old times like in old europe on top of a religious populance and a cold climate but the benefit is less gangs and guns and extreme violence like school shootings and a police state?
  9. #9
    LiquidIce Houston
    GOT IT GOING!

    It was the breadboard. I moved everything to the left by two notches and now this light blinks when I press the little button. Now I can finally start writing more code to do other things.

    Pics or it didnt happen. Congrats dude.
  10. #10
    -SpectraL coward [the spuriously bluish-lilac bushman]
    http://www.electroschematics.com/9529/atmega8-basic-input-output-interfacing-1/
  11. #11
    SBTlauien African Astronaut
    http://www.electroschematics.com/9529/atmega8-basic-input-output-interfacing-1/

    Yes this it it. Written by t.k. Hareendran from India.
  12. #12
    Sophie Pedophile Tech Support
    Yes this it it. Written by t.k. Hareendran from India.

    Spectral just likes to pretend he knows stuff by right clicking on the image to see where you hotlinked it from and then posting a link to the article you already know exists in an attempt to look knowledgable on the subject. It's quite sad actually.
  13. #13
    -SpectraL coward [the spuriously bluish-lilac bushman]
    Spectral just likes to pretend he knows stuff by right clicking on the image to see where you hotlinked it from and then posting a link to the article you already know exists in an attempt to look knowledgable on the subject. It's quite sad actually.

    You don't scare me.
  14. #14
    Sophie Pedophile Tech Support
    You don't scare me.

    Silence knave, scaring you was never part of the equation. Just ousting you for what you are.
  15. #15
    SBTlauien African Astronaut
    I wish my parts would arrive so I could keep building this stuff. I'm still not sure what I should build though.
Jump to Top