Hi Guys,
I am new to the electronic stuff but not new to the programing. So i always wanted to program something that does something that i can get into my hands. :)...
I done some things and got the hand of it .
I am doing a hobby project, for plant irrigation. I wrote the code for my plants and it works on arduino but i want to scale it down to Attiny.
So i made a simple program that blinks for practice like :
int led = 0;
void setup{
pinmode (led, OUTPUT);
}
void loop{
digitalWrite(0,HIGH);
delay(300);
digitalWrite(0,LOW);
delay(300);
digitalWrite(0,HIGH);
}
And that works great i connect the led on pin 5 and i work's . Now i won't to add DHT 11 to monitor the temperature and humidity.
int led = 0;
int val = 0;
void setup{
pinmode (led, OUTPUT);
}
void loop{
val = analogRead(2);
if val > 20){
digitalWrite(0,HIGH);
delay(300);
digitalWrite(0,LOW);
delay(300);
digitalWrite(0,HIGH);
}
}
And it doesn't do nothing . I have tried messing arround whit the pins , and without the analogRead() but i am getting nowhere.
This is located in hardware/attiny45_85/pins_arduino.c
ATMEL ATTINY45 / ARDUINO
//
// +-/-+
// Ain0 (D 5) PB5 1| |8 Vcc
// Ain3 (D 3) PB3 2| |7 PB2 (D 2) Ain1
// Ain2 (D 4) PB4 3| |6 PB1 (D 1) pwm1
// GND 4| |5 PB0 (D 0) pwm0
// +----+
Can someone give me a clue why it doesn't work...