tweaking test code

This commit is contained in:
Kyle Isom 2020-12-21 17:38:22 -08:00
parent cbfde6b3a4
commit 0dbfc80cf3
3 changed files with 64 additions and 15 deletions

32
stage2/Makefile Normal file
View File

@ -0,0 +1,32 @@
BOARD := adafruit_feather_m0
FIRMWARE := .pioenvs/$(BOARD)/firmware.bin
SOURCES := \
src/main.cc
PIO := pio run -e $(BOARD)
$(FIRMWARE): $(SOURCES)
$(PIO)
PHONY: all
all: $(FIRMWARE)
.PHONY: upload
upload: $(FIRMWARE)
$(PIO) -t upload
.PHONY: monitor
monitor:
$(PIO) -t monitor
.PHONY: deploy
deploy: $(FIRMWARE)
$(PIO) -t upload && sleep 0.5 && $(PIO) -t monitor
.PHONY: clean
clean:
$(PIO) -t clean
.PHONY: cloc
cloc:
cloc include lib src

View File

@ -16,11 +16,14 @@ framework = arduino
; 28: Adafruit NeoPixel library
; 83: Adafruit RTClib
; 571: Adafruit ILI9341 library
lib_deps =
- Wire
- SPI
- SD
- 28
- 83
- 571
- arturo182/BBQ10Keyboard
lib_deps = SD, SPI, Wire, 28, 83, 571, arturo182/BBQ10Keyboard, 2082, 13, 6214
[env:adafruit_feather_m0]
platform = atmelsam
board = adafruit_feather_m0
framework = arduino
; 28: Adafruit NeoPixel library
; 83: Adafruit RTClib
; 571: Adafruit ILI9341 library
lib_deps = SD, SPI, Wire, 28, 83, 571, arturo182/BBQ10Keyboard, 2082, 13, 6214

View File

@ -2,27 +2,41 @@
Adafruit_NeoPixel pixels(1, 11, NEO_GRB + NEO_KHZ800);
auto cRed = pixels.Color(255, 0, 0);
auto cBlue = pixels.Color(0, 0, 255);
void
init()
setup()
{
Serial.begin(115200);
pixels.begin();
pixels.clear();
pixels.show();
}
void
main()
loop()
{
static bool on = false;
Serial.println("blink");
if (on) {
pixels.clear();
for (int i = 10; i < 255; i++) {
auto c = pixels.Color(0, (uint8_t)i, 0);
pixels.setPixelColor(0, c);
pixels.show();
delay(4);
}
on = false;
} else {
pixels.setPixelColor(0, pixels.color(0, 255, 0));
for (int i = 255; i > 9; i--) {
auto c = pixels.Color(0, (uint8_t)i, 0);
pixels.setPixelColor(0, c);
pixels.show();
delay(4);
}
on = true;
}
pixels.show();
delay(1000);
}