Pages: 1 [2]   Go Down
Author Topic: Newbie question on Standalone ATMega  (Read 2036 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My teacher said to connect CD+ on the ULN's to the +12 I'll be supplying the 7-segs so that when the ATMega goes low, it'll supply them with the +12 they need to work, instead of the +5 supplied by the chip. Is this not how they work?

I tried having A0 - A5 connected to ground like digital inputs, but I was getting really screw results while breadboarding. The switches were closing unreliably, just by tapping or getting close to the actual wires without having to actually press the buttons. Once I put the resistors in, that solved all my problems.

Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 439
Posts: 23739
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Connecting the COM on the ULN2003 to +12V will not do anything for you.
Connecting +12V to your anodes, then a resistor, then the outputs of the ULN2003 is what you need.

A0-A5 - did you try this? Simple test to see if a pin is grounded with a momentary button, internal pullup resistor holds the  pin high.
Code:
button0 = 14; // pin A0
button1 = 15; // pin A1
button2 = 16; // pin A2
button3 = 17; // pin A3
button4 = 18; // pin A4
button5 = 19; // pin A5
pin13LED = 13;  // on board LED for testing

void setup(){
pinMode (button0, INPUT);
digitalWrite (button0, HIGH); // turns on internal pullup
pinMode (button1, INPUT);
digitalWrite (button1, HIGH); // turns on internal pullup
pinMode (button2, INPUT);
digitalWrite (button2, HIGH); // turns on internal pullup
pinMode (button3, INPUT);
digitalWrite (button3, HIGH); // turns on internal pullup
pinMode (button4, INPUT);
digitalWrite (button4, HIGH); // turns on internal pullup
pinMode (button5, INPUT);
digitalWrite (button5, HIGH); // turns on internal pullup
pinMode (pin13LED, OUTPUT);
}
void loop(){
if (digitalRead (button0) == LOW){  // button0 switch pressed to connect it to ground?
digitalWrite (pin13LED, HIGH); // turn on the onboard LED for 0.1 second
delay (100);
digitalWrite(pin13LED, LOW);
}
if (digitalRead (button1) == LOW){  // button1 switch pressed to connect it to ground?
digitalWrite (pin13LED, HIGH); // turn on the onboard LED for 0.1 second
delay (100);
digitalWrite(pin13LED, LOW);
}if (digitalRead (button2) == LOW){  // button2 switch pressed to connect it to ground?
digitalWrite (pin13LED, HIGH); // turn on the onboard LED for 0.1 second
delay (100);
digitalWrite(pin13LED, LOW);
}if (digitalRead (button3) == LOW){  // button3 switch pressed to connect it to ground?
digitalWrite (pin13LED, HIGH); // turn on the onboard LED for 0.1 second
delay (100);
digitalWrite(pin13LED, LOW);
}if (digitalRead (button4) == LOW){  // button4 switch pressed to connect it to ground?
digitalWrite (pin13LED, HIGH); // turn on the onboard LED for 0.1 second
delay (100);
digitalWrite(pin13LED, LOW);
}if (digitalRead (button5) == LOW){  // button5 switch pressed to connect it to ground?
digitalWrite (pin13LED, HIGH); // turn on the onboard LED for 0.1 second
delay (100);
digitalWrite(pin13LED, LOW);
}
}
There is no reason for the A0-A5 pins to act screwy when they are defined as digital pins. No resistors are needed.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The 7-segs are common anode, so I've got +12V running to the anode. The cathodes are then hooked up to the output side of the ULN2003's.
Logged

Pages: 1 [2]   Go Up
Jump to: