Commit 4c703c82 authored by Erik Strand's avatar Erik Strand

Add an example Arduino sketch

parent fc66889f
*.swp
*.swo
*.elf
.DS_Store
......@@ -39,7 +39,8 @@ To write code and load it, Jake uses [PlatformIO](https://platformio.org/platfor
We're not going to beat Adafruit's documentation on setting up the Arduino IDE, so just take a
gander over
[here](https://learn.adafruit.com/adafruit-feather-m4-express-atsamd51/using-with-arduino-ide). It's
their bootloader, after all.
their bootloader, after all. An example sketch lives in the [blink-arduino](blink-arduino)
directory.
### Real Registers in an Arduino World
......
# Programming with the Arduino IDE
This doc assumes you've already burned an Arduino compatible bootloader on your board, and set up
the Arduino IDE to talk to it. If you still need to do this, check out the README one level up.
After that, just select the right settings in the Arduino IDE tools menu and you're good to go:
- Board: Adafruit Feather M4 Express (SAMD51)
- Port: depends on your OS, but it should say Adafruit Feather M4 Express (SAMD51) somewhere
- Programmer: USBtinyISP
The other settings are up to you. Defaults are fine.
![Arduino IDE](img/arduino_ide.jpg)
Note that this blinky sketch is fancy, and prints "hello world" over USB serial. To see it, you can
use the Arduino IDE's serial monitor. Getting this to work would be a lot more difficult without the
Arduino libraries.
#define RED_LED 25
#define GREEN_LED 9
void setup() {
pinMode(RED_LED, OUTPUT);
pinMode(GREEN_LED, OUTPUT);
// This turns off the LEDs.
digitalWrite(RED_LED, HIGH);
digitalWrite(GREEN_LED, HIGH);
Serial.begin(9600);
}
void loop() {
digitalWrite(RED_LED, LOW);
digitalWrite(GREEN_LED, LOW);
Serial.println("hello world");
delay(500);
digitalWrite(RED_LED, HIGH);
digitalWrite(GREEN_LED, HIGH);
delay(500);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment