ATTiny85 6 add UART — ATtiny85 simulation

An interactive ATtiny85 circuit simulation you can run free in your browser on Velxio, by ian7171.

Components

Sketch code

#define F_CPU 8000000UL // Is slower than the CPU but for this is fine

#include <avr/io.h>
#include <avr/pgmspace.h>
#include <util/delay.h>
#include <stdint.h>
#include "fn_i2c.h"
#include "fn_UART.h"

int main(void)

{

    usi_i2c_init();

    oled_init();

    oled_clear();

    oled_cursor(10, 2);

    print_to_oled(PSTR("Hello Aiden"));

    uart_init();

while (1)

    {

        uart_putc('U');

        PORTB |= (1 << UART_TX);

        /* 3-bit idle gap */

        for (uint8_t i = 0; i < 3; i++)

            _delay_us(UART_BIT_US);

    }

    return 0;

}

More projects by ian7171