My project works great on the UNO but really having just 1 analog in and 1 PWM out. i do use the 1.1V analog ref though, does this also work on the '85 ?
Yup. The Attiny85 has a 1.1V bandgap reference which can be used as an analog reference.
It can be enabled as the reference for the ADC as follows:
ADMUX &= ~((1<<REFS0)|(1<<REFS2));
ADMUX |= (1<<REFS1);
can't i just use analogReference() ? or is it not supported by the IDE ?
Short answer: you possibly could use analogReference().
Long answer: you will need to use a different core library set for the Attiny series. It depends what has been implemented.
well I've got the high low tech thing to get the tiny's working, is there more stuff I need to have put in ?
sparkylabs:
My project works great on the UNO but really having just 1 analog in and 1 PWM out. i do use the 1.1V analog ref though, does this also work on the '85 ?
A glance at the datasheet would tell you that it has 1.1V and 2.56V references.
sparkylabs:
can't i just use analogReference() ? or is it not supported by the IDE ?
It's nothing to do with the IDE, it will depend on the core you installed (most of them are quite complete...)
core ? do you mean the support files ?
sparkylabs:
core ? do you mean the support files ?
You have to install something like this before you can use an ATtiny with the IDE:
https://code.google.com/p/arduino-tiny/
There's a few different ones out there and we don't know which one you installed.
I'm using: http://hlt.media.mit.edu/?p=1229 which does not list it so I guess I'm out of luck unless I can use C code directly ?
sparkylabs:
I'm using: http://hlt.media.mit.edu/?p=1229 which does not list it so I guess I'm out of luck unless I can use C code directly ?
Direct programming AVR chips is easy. For the ADC you only need to manipulate three registers.
ADMUX = XXXX; // Select a source
ADCSRA = 0xd0; // Start a conversion
while ((ADCSRA&0x10)==0) {
// Wait for conversion to complete
}
int val = ADC; // Get result
(Or something like that ... I just typed that with no testing, see datasheet...)