week 7


Embedded Programming


Oct 27, 2020

This week was for embedded programming. We uploaded programs on the board made in last weeks assignment.

In last weeks assignment, I had made a board based on attiny1614 with a switch and an LED. This week I wanted to test it with code.

I tried using the ftdi board and the ftdi-updi converter I had made earlier. I was not able to achieve succes with it, while trying to figure out a way, I came across a tutorial that used an arduino to program attiny.https://www.youtube.com/watch?v=AL9vK_xMt4E&t=330s this tutorial made sense to me so I decided to try it out. I used an arduino Uno as a programmer.

It worked!

Program:


const int buttonPin = 1;     // the number of the pushbutton pin
const int ledPin =  8;      // the number of the LED pin
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
}

void loop() {
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
  // blink LED:
  digitalWrite(ledPin, HIGH);
  delay(200);
  digitalWrite(ledPin, LOW);
  delay(200);
} else {
  // turn LED off:
  digitalWrite(ledPin, LOW);
}
}