Go Down

Topic: Trouble with charlieplexed LEDs and ATTiny85 (Read 609 times) previous topic - next topic

zenwebb

I'm trying to control 6 LEDs using an ATTiny85 (HLT's implementation), but I'm getting very odd results so far.

I've attached a schematic of the circuit I have set up. The six LEDs are set up in a basic charlieplexed arrangement and controlled via 3 control pins. The resistor values I am using right now are 150ohms all around.

I'm just trying to turn on one LED (LED1) by setting PORTA to LOW, PORTB to HIGH and PORTC as input (high impedence).

The LED doesn't turn on, and I get unusual voltage readings at the pins. Pin 0 (PORTA) has 2.9V, and pin 1 (PORTB) has 2.7V.

I thought that maybe LOW wasn't actually 0V, so I changed the digitalWrite calls to analogWrite calls and used 0 and 255 respectively to achieve LOW and HIGH. But I get the same result!

Here is the code I'm trying out. Am I missing something obvious?

Code: [Select]
#define  PORTA  0
#define  PORTB  1
#define  PORTC  2
#define  PIEZO  4

void setup() {
pinMode(PORTA, OUTPUT);
pinMode(PORTB, OUTPUT);
pinMode(PORTC, INPUT);
}

void loop() {
  digitalWrite(PORTA, LOW);
  digitalWrite(PORTB, HIGH);
}
Grad student, creative technologist, OSHW engineer
http://jason-webb.info

Osgeld

PORTA,B,C are avr keywords defining a group of pins and may screw you up, try renaming them to something else
http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL

Hippynerd

You could also test the circuits to eliminate that as a problem.
https://sites.google.com/site/rgbledcubes

fungus

#3
Jan 13, 2013, 09:54 pm Last Edit: Jan 13, 2013, 09:56 pm by fungus Reason: 1

Here is the code I'm trying out. Am I missing something obvious?

Code: [Select]
#define  PORTA  0
#define  PORTB  1
#define  PORTC  2
#define  PIEZO  4

void setup() {
pinMode(PORTA, OUTPUT);
pinMode(PORTB, OUTPUT);
pinMode(PORTC, INPUT);
}

void loop() {
 digitalWrite(PORTA, LOW);
 digitalWrite(PORTB, HIGH);
}



Yes. "PORTB" etc. is the names of the Tiny85 output port used by the compiler. Redefining it to something else will probably be disastrous. Use different names.

nb. "PINB" in no good either...try lower case words.



No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Go Up