Pre-requisites
🌲 An indoor infrared receiver and transmitter with a temperature sensor 🎐
Blinky LED on a crystalless Arduino Zero
Pre-requisites
Create a blinky LED firmware with SAMD21G micro-controller on a custom PCB without crystal.
To ensure the blinky works with the crytalless option, you have to:
build.extra_flags
in ~/Library/Arduino15/packages/arduino/hardware/samd/1.8.6/boards.txt
on macOS or as part of options in the arduino-cli
commandarduino-cli compile --fqbn arduino:samd:arduino_zero_native --build-properties build.extra_flags="-DCRYSTALLESS -D__SAMD21G18A__ {build.usb_flags}" ./
For serial printing, SerialUSB.println()
should be used instead of Serial.println()
because SerialUSB
uses the Native Port, which is an emulated serial port (USB-CDC).
Steps to upload the blinky firmware:
make
to upload the blinky firmware with crystalless option#define LED 13
void setup() {
pinMode(LED, OUTPUT);
// SerialUSB.begin(9600);
// while (!SerialUSB) {}
// delay(1000);
// SerialUSB.println("Start!");
}
void loop() {
// SerialUSB.println("HIGH");
digitalWrite(LED, HIGH);
delay(200);
// SerialUSB.println("LOW");
digitalWrite(LED, LOW);
delay(200);
}
BOARD?=arduino:samd:arduino_zero_native
PORT := $(shell ls /dev/cu.usbmodem*)
.PHONY: default lint all flash clean
default: lint all flash clean
lint:
cpplint --extensions=ino --filter=-legal/copyright,-whitespace/line_length,-readability/casting,-readability/todo *.ino
all:
# This custom PCB does not have a crytal on pins PA00 and PA01
# Hence, use -DCRYSTALLESS to replace the extra_flags in boards.txt
arduino-cli compile --fqbn $(BOARD) --build-properties build.extra_flags="-DCRYSTALLESS -D__SAMD21G18A__ {build.usb_flags}" ./
flash:
arduino-cli upload -p $(PORT) --fqbn $(BOARD)
clean:
rm -r build