Embedded Programming


Read the datasheet for the microcontroller

  • Before I do the programming, I needed to know more about MCU.
  • My board was using Atiny85 and I could check the data sheet here
  • First I checked the pinout of Atiny85.
  • week8



  • checked Pinout and my board's Pinout connection.
  • I used RGB LED. The pinout was connected to PB0, PB1, and PB2, while the switch was connected to PB4.

  • week8



    Programming

  • I checked the Pinout connection and tried programming.
  • tried programming on the Aduino board using a scratch.
  • downloaded the S4A that can program the Aduino board and downloaded and installed the firmware to read the board.
    week8



    week8



  • I checked the operation of the board and simply programmed it.
  • Through programming, we could make LEDs that shine every second.
    week8



    week8



  • Scratch was easy for beginners to use because the commands available were visible.

  • After simply using the scratch, I returned to Aduino and tried programming.
  • I connected the my board with the my laptop.
  • But my laptop could not read my board (Windows 7...) and I was able to try programming with Jeong Hwan's help.
    week8



  • I connected my board to MacBook and set up the tool and programming it. My ISP and RGB board worked well and I was able to light up the red light every second by programming.
    week8



    week8



  • TEST Programming





  • I wanted to use RGB LEDs to make more color, but I was not able to make progress because I was not good at programming, but with Craig's help, I was able to complete programming.
  • Functionality is set so that RGB LED and switch are available.
    week8



  • The use of PinMode has been made so that LEDs.
    week8



  • Finally, the random function was used to make the random light
    week8



  • Random LED Programming





  • Programming is too difficult and there are many things to know...
  • My random led color code
    int ledR = 0;
    int ledG = 2;
    int ledB = 1;
    int swPin = 4;
    
    byte number;
    
    #include 
    
    SoftwareSerial mySerial(2, 3); // RX, TX
    
    
    void setup() {
    
      pinMode (ledR,OUTPUT);
      pinMode (ledG,OUTPUT);
      pinMode (ledB,OUTPUT);
      pinMode (swPin,INPUT_PULLUP);
    
      mySerial.begin(4800);
    
    
    }
    
    void loop() {
    
    
     mySerial.println(number);
    
     boolean push = digitalRead(swPin);
     if(push == true){
         // give me a number between 0 - 5 (inclusive)
    number = random (0, 6);
     }
    
    if (number == 0) {
      digitalWrite(ledB, HIGH);
      digitalWrite(ledR, LOW);
      digitalWrite(ledG, HIGH);
      delay (100); }
    
    if (number == 1)  {
      digitalWrite(ledR, HIGH);
      digitalWrite(ledB, LOW);
      digitalWrite(ledG, HIGH);
      delay (100); }
    
    if (number == 2)  {
      digitalWrite(ledB, HIGH);
      digitalWrite(ledG, LOW);
      digitalWrite(ledR, HIGH);
      delay (100); }
    
    if (number == 3) {
      digitalWrite(ledG, LOW);
      digitalWrite(ledR, LOW);
      digitalWrite(ledB, HIGH);
      delay (100); }
    
    if (number == 4) {
      digitalWrite(ledR, HIGH);
      digitalWrite(ledG, LOW);
      digitalWrite(ledB, LOW);
      delay (100); }
    
    if (number == 5) {
      digitalWrite(ledR, LOW);
      digitalWrite(ledB, LOW);
      digitalWrite(ledG, HIGH);
      delay (100); }
    
    
    
    
    }
    
    




  • my work

  • yj Programminghere