was struggling with the analog read last week, for those that are using
the core 85 here is what i've learnt:
you need to set your voltage reference, its not done by default to save
space..
analogReference(0);
-- pick one of these,
http://code.google.com/p/arduino-tiny/source/browse/trunk/hardware/tiny/cores/tiny/wiring.h?r=64
// X 0 0 VCC used as Voltage Reference, disconnected from PB0 (AREF).
#define DEFAULT (0)
// X 0 1 External Voltage Reference at PB0 (AREF) pin, Internal Voltage
Reference turned off.
#define EXTERNAL (1)
// 0 1 0 Internal 1.1V Voltage Reference.
#define INTERNAL (2)
#define INTERNAL1V1 INTERNAL
// 1 1 1 Internal 2.56V Voltage Reference with external bypass capacitor
at PB0 (AREF) pin(1).
#define INTERNAL2V56 (7)
Also the returned values are reversed, high is 0 and low is 1023.. so
just 1023 - value .. but then if you are reading this you already know
it since digital write is backwards, high turns the led off and low
turns it on :)
--
Signatures are useless, no one reads them right?
Writers who use a computer swear to its liberating power in tones that
bear witness to the apocalyptic power of a new divinity. Their
conviction results from something deeper than mere gratitude for the
computer's conveniences.
Every new medium of writing brings about new intensities of religious
belief and new schisms among believers. In the 16th century the printed
book helped make possible the split between Catholics and Protestants.
In the 20th century this history of tragedy and triumph is repeating
itself as a farce.
Those who worship the Apple computer and those who put their faith in
the IBM PC are equally convinced that the other camp is damned or
deluded. Each cult holds in contempt the rituals and the laws of the
other. Each thinks that it is itself the one hope for salvation.
-- Edward Mendelson, "The New Republic", February 22, 1988