I was going to fuse Attiny44A with AVRISP mkII but it showed these error message all the time. I faced that bad connection issue also in week4 so I thought it is better to move on with Arduino as ISP.
avrdude: stk500v2_command(): command failed
avrdude: stk500v2_program_enable(): bad AVRISPmkII connection status: Target not detected
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override this check.
Following Programming an ATtiny w/ Arduino 1.6 (or 1.0) in High-Low Tech, I could use the Arduino IDE to program Attiny44A.
Boom! Debug time
The error messages said that reset pin did not work. Therefore after checking the connection and components, I found out that something funny here.
I followed KiCAD labels to solder and these two labels confused me.
They should be like this.
Fixing them
Burn bootloader again
Done! Well done!
According to Attiny44A data sheet, for next step, I was going to check pin mode with Attiny44A and High-Low tech library.
Then I could have made a simple demo with how long I press button, and LED would light up in same time.
int ledPin = 0;
int buttonPin = 2;
int buttonPushCounter = 0;
int ledState = 0;
int buttonState = 0;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT);
}
void loop() {
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH && ledState == 0) {
buttonPushCounter++;
delay(50);
}
if (buttonState == LOW && buttonPushCounter >= 1) {
for(int i=0; i<=buttonPushCounter; i++) {
digitalWrite(ledPin, HIGH);
delay(50);
ledState = 1;
}
buttonPushCounter = 0;
} else {
digitalWrite(ledPin, LOW);
ledState = 0;
}
}
Result