Arduino Forum

Using Arduino => LEDs and Multiplexing => Topic started by: h4t on Jan 13, 2013, 03:02 am

Title: Trouble with charlieplexed LEDs and ATTiny85
Post by: h4t on Jan 13, 2013, 03:02 am
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);
}
Title: Re: Trouble with charlieplexed LEDs and ATTiny85
Post by: Osgeld on Jan 13, 2013, 06:20 am
PORTA,B,C are avr keywords defining a group of pins and may screw you up, try renaming them to something else
Title: Re: Trouble with charlieplexed LEDs and ATTiny85
Post by: Hippynerd on Jan 13, 2013, 06:44 pm
You could also test the circuits to eliminate that as a problem.
Title: Re: Trouble with charlieplexed LEDs and ATTiny85
Post by: fungus on Jan 13, 2013, 09:54 pm

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.