Pages: [1]   Go Down
Author Topic: Trouble with charlieplexed LEDs and ATTiny85  (Read 454 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Sr. Member
****
Karma: 2
Posts: 254
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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);
}


* Jar-of-fireflies-schematic.png (18.77 KB, 1477x1102 - viewed 14 times.)
Logged

Grad student, creative technologist, OSHW engineer
http://jason-webb.info

SE USA
Offline Offline
Faraday Member
**
Karma: 40
Posts: 3783
@ssh0le
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

PORTA,B,C are avr keywords defining a group of pins and may screw you up, try renaming them to something else
Logged


Eugene, Oregon
Offline Offline
Sr. Member
****
Karma: 9
Posts: 388
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You could also test the circuits to eliminate that as a problem.
Logged


Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 120
Posts: 4594
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Code:
#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.



« Last Edit: January 13, 2013, 03:56:57 pm by fungus » Logged

No, I don't answer questions sent in private messages...

Pages: [1]   Go Up
Jump to: