diff --git a/.gitignore b/.gitignore index 213bca7d1b806d782870e8db489b44121cb2b3c6..ac24719ba6db7300057e71f1d056f6e71a0dd799 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.swp *.swo *.elf +.DS_Store diff --git a/README.md b/README.md index 889cb8bf90cf08410c04cc5c78a3575f20a1385e..b4691ef30aa8ea565e6a727a15b655c96f580c08 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/blink-arduino/README.md b/blink-arduino/README.md new file mode 100644 index 0000000000000000000000000000000000000000..5d668ffd66c644b5f5facf98cec42e1955933de7 --- /dev/null +++ b/blink-arduino/README.md @@ -0,0 +1,18 @@ +# 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. + + + +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. diff --git a/blink-arduino/blink-arduino.ino b/blink-arduino/blink-arduino.ino new file mode 100644 index 0000000000000000000000000000000000000000..178759fbeabc99ae0bc457b4a2f4e40845e3304a --- /dev/null +++ b/blink-arduino/blink-arduino.ino @@ -0,0 +1,23 @@ +#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); +} diff --git a/blink-arduino/img/arduino_ide.jpg b/blink-arduino/img/arduino_ide.jpg new file mode 100644 index 0000000000000000000000000000000000000000..5684a093c2d5b6f338e022e6a2b55578353a6690 Binary files /dev/null and b/blink-arduino/img/arduino_ide.jpg differ