Last active
November 23, 2017 18:45
-
-
Save awkward-ninja/cee598222f29cb8944463351b500ed48 to your computer and use it in GitHub Desktop.
Barebones Blinky for Arduino Nano over USB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Arduino.h" | |
int main () { | |
init (); | |
pinMode (13, OUTPUT); | |
for (;;) { | |
digitalWrite (13, HIGH); | |
delay (100); | |
digitalWrite (13, LOW); | |
delay (100); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ARDUINO_DIR = /usr/share/arduino/hardware/arduino | |
ARDUINO_CORE_DIR = $(ARDUINO_DIR)/cores/arduino | |
ARCH = atmega328p | |
CORE_SRC = \ | |
$(ARDUINO_CORE_DIR)/wiring.c \ | |
$(ARDUINO_CORE_DIR)/wiring_digital.c | |
.PHONY: all | |
all: main.elf | |
.PHONY: clean | |
clean: | |
-rm -f main.elf | |
.PHONY: install | |
install: main.elf | |
avrdude -p $(ARCH) -c arduino -P /dev/ttyUSB0 -b 57600 -D -U flash:w:$< | |
main.elf: main.c $(CORE_SRC) | |
avr-gcc -mmcu=$(ARCH) -DF_CPU=16000000L \ | |
-I $(ARDUINO_CORE_DIR) \ | |
-I $(ARDUINO_DIR)/variants/eightanaloginputs \ | |
-o $@ $^ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment