> For the complete documentation index, see [llms.txt](https://khalil-lab.gitbook.io/evolver/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://khalil-lab.gitbook.io/evolver/extensions/custom-experiments/epace/attiny1634-writing.md).

# ATTiny1634 Writing

For upgrading an Arduino so that it can program another microcontroller

<https://www.arduino.cc/en/Tutorial/BuiltInExamples/ArduinoISP>

<https://github.com/FYNCH-BIO/evolver-arduino/blob/master/ATtiny1634/lightsense.c>

## AVRDUDE and AVR-gcc

### Follow instructions here:

<https://blog.zakkemble.net/avr-gcc-builds/>

Tried to upload blink to Arduino Uno and got this error

avrdude: stk500\_recv(): programmer is not responding

avrdude: stk500\_getsync() attempt 1 of 10: not in sync: resp=0x58

&#x20;

Had to remove all wires going to Arduino ports and unplug usb before it would upload

## Pin layout Arduino to ATtiny1634

Map of controller pins in on the microcontroller

![](https://3394537773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYy5AdmKzUTn7D8n357Md%2Fuploads%2F3cOMHkUIOqGQtgp388dW%2Fimage.png?alt=media\&token=524086d3-efe5-4dca-ab21-e6235b24dca3)![](https://3394537773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYy5AdmKzUTn7D8n357Md%2Fuploads%2FGrFllKdlzxQ0rAweH8Sx%2FUntitled%20picture.png?alt=media\&token=d09ce5a3-bf8c-436e-b140-2e356a19984d)

&#x20;<img src="https://3394537773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYy5AdmKzUTn7D8n357Md%2Fuploads%2FKxjmDnBigHJmM9RmWVaL%2FUntitled%20picture.jpg?alt=media&amp;token=6792a73d-4bd4-4e82-a18b-f2918e085437" alt="" data-size="original">

## Burning ATtiny1634

<https://www.arduino.cc/en/Tutorial/BuiltInExamples/ArduinoISP>

&#x20;

Load up ArduinoISP (in the Arduino IDE examples) onto the programmer Arduino

Download C code for ATtiny from here:

<https://github.com/FYNCH-BIO/evolver-arduino/tree/master/ATtiny1634>

&#x20;

### On the terminal

Navigate to the folder containing ATtiny code (lightsense.c)

#### Run commands:

avr-gcc -g -Os -mmcu=attiny1634 -c lightsense.c\
avr-gcc -g -mmcu=attiny1634 -o lightsense.elf lightsense.o\
avr-objcopy -j .text -j .data -O ihex lightsense.elf lightsense.hex\
avrdude -p t1634 -P \<Your Arduino Port> -c arduino -b 19200 -U flash:w:lightsense.hex -v -v -v -v

*From <*[*https://github.com/FYNCH-BIO/evolver-arduino/tree/master/ATtiny1634*](https://github.com/FYNCH-BIO/evolver-arduino/tree/master/ATtiny1634)*>*

Replace \<Your Arduino Port> with the port used by your Arduino (found in IDE under Tools>Port)

avrdude -p t1634 -P COM9 -c arduino -b 19200 -U flash:w:lightsense.hex -v -v -v -v

avr-gcc -g -Os -mmcu=attiny1634 -c LEDblink.c\
avr-gcc -g -mmcu=attiny1634 -o LEDblink.elf LEDblink.o\
avr-objcopy -j .text -j .data -O ihex LEDblink.elf LEDblink.hex\
avrdude -p t1634 -P COM9 -c arduino -b 19200 -U flash:w:LEDblink.hex -v -v -v -v

## Alternative guide? or ATTiny as an arduino?

<https://github.com/SpenceKonde/ATTinyCore>
