Step 3Uploading the software
Installing the ATtiny support:
- Download: attiny45_85.zip
- Locate your Arduino sketchbook folder (you can find its location in the preferences dialog in the Arduino software)
- Create a new sub-folder called “hardware” in the sketchbook folder.
- Copy the attiny45_85 folder from the attiny45_85.zip to the hardware folder.
- Restart the Arduino development environment.
- Run the Arduino development environment.
- Open the ArduinoISP sketch from the examples menu.
- Select the board and serial port that correspond to your Arduino board.
- Upload the ArduinoISP sketch.
- Select “ATtiny45 (w/ Arduino as ISP)” or “ATtiny85 (w/ Arduino as ISP)” from the Tools > Board menu (leave the serial port set to that of your Arduino board).
- Upload the sketch.
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
If you get an other error, just try again that just might work.
If you did the complete electronics on your breadboard in the previous step, it should work now. This means that if you turn off the lights, than put power on your breadboard, the LED will blink when you shine a light on the sensor. If you push the button, the LED will flash as many times as the sensor was lighted.
The SKETCH (code)
int knopPin = 4;
int ledPin = 0;
int knopAan = 0;
int hoeLicht = 0;
int Verschil = 0;
int Teller = 0;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(knopPin, INPUT);
hoeLicht = analogRead(1); // read on the sensor how dark it is
Verschil = hoeLicht + 50; // set the sensitivity of the sensor on 50
}
void loop(){
hoeLicht = analogRead(1);
if (hoeLicht < Verschil){ //when the sensor is lighted
digitalWrite(ledPin, LOW);
}
else {
digitalWrite(ledPin, HIGH);
Teller ++;
if (Teller > 100){Teller = 99;}
delay(3000);
digitalWrite(ledPin, LOW);
delay(100);
}
knopAan = digitalRead(knopPin); //check the button
if (knopAan == LOW) { //when the button is pushed
delay(600); //wait till your finger is from the button
for (int i=1; i <= Teller; i++){ //counting the hits
digitalWrite(ledPin, HIGH);
delay(400);
digitalWrite(ledPin, LOW);
delay(400);
}
}
}
zaklamp_tikkertje_op_miniduini.pde989 bytes| « Previous Step | Download PDFView All Steps | Next Step » |
![]() |
Add Comment
|





















































