Programming ATTiny MCUs from Flowcode
The ATTiny range of MCU chips provide a powerful chip with a minimum of hardware overhead. ATTiny chips provide 1 instruction per clock cycle performance with a wide range of memory and speeds available. All you need to do is add power.
However, one problem is how to program the MCU. There is no USB port or UART to connect to - and the chips do not run a bootloader program. There are several ways to do this - and the simplest when working with Flowcode is to use a USBTiny programmer.
For a simple example I used a ATTiny13a on a breadboard with a LED connected to pin B3 and ground (with a 220 ohm resistor) to get the standard 'blink' program working.
The USBTiny I have doesn't have the pins marked (great idea!) - but the pin out is

These pins need to connect to the corresponding pins on the ATTiny so Vcc is connected to Vcc, Gnd to Gnd etc It is worthwhile creating a labelled cable to do this.
The ATTiny has the following pins:

The other pins are MOSI to PB0, MISO to PB1, SCK to PB2 and RST to PB5
Then in Flowcode - create your program. Choose the appropriate MCU and click 'Compile to Chip' If all is well the program should upload and (in this simple example) flash the LED. However, you might find the LED is flashing at the wrong speed (it should be 1 second on 1 off) This is because the MCU fuses are set incorrectly.
To program the fuses the simplest way is to use the Arduino IDE (from Software | Arduino) Simply create a new project with the required chip (note you might need to install the relevant chip pack using the boards manager) and select the relevant clock settings (slower speeds use less power and may be more appropriate for battery operation) and choose the USBTiny as programmer. Then select 'burn bootloader' - this just programs the fuses (there is no bootloader program for these chips)
Then reprogram the MCU with the blink program (in the example code above the ATTiny is running at 9.6MHz (1.2, 4.8 and 9.6MHz) - ATTiny85 would use 1, 8 or 16MHz for example). These speeds are available with no external components! The correct speed needs to be assigned in 'project options' in Flowcode for timings to be correct.
When the LED flashes 1s pulses correctly - congratulations you have successfully programmed your MCU.
