CANT GET SKETCH TO WORK ON ATTINY 85 ONLY WORKS WITHOUT AM I WIRING IT WRONG?
HI GUYS. I HAVE A LDR light sensor I would like to use to turn on a light bulb through a attin85. when I upload the sketch to the Arduino it works fine. but when I upload to the attiny, I can't get it to work. am I'm wiring it wrong? when I put my signal from my ldr sensor to AO and 2 to the led it works on Arduino, but when I do that with the Attiny85 it doesn't do anything. The sketch did upload correctly though so it has to be me wiring it wrong or I need to change the code maybe to cater to the attiny85?
my sketch is
int LDR = 0;
int LDRValue = 0;
void setup()
{
pinMode(2, OUTPUT);
void loop()
{
LDRValue = analogRead(LDR);
delay(50);
if (LDRValue < light_sensitivity)
{
digitalWrite(2, HIGH);
}
else
{
digitalWrite(2, LOW);
}
}
Discussions
2 years ago
Hi, I have never used attiny85, but I just had a quick look at the datasheet. if its anything like a PIC micro then, because most of the pins are multiplexed for other uses, its my guess that the pins will need to be programmed. If I have given you poor information due to my ignorance, then I apologise. This link may shed some light on a solution.
https://www.marcelpost.com/wiki/index.php/ATtiny85_ADC
Terry