Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
молния Gang
Shelf Light
Commits
057ac066
Commit
057ac066
authored
Jun 02, 2020
by
Fence
🌈
Browse files
switch to arduino-mk & fast led for a quick prototype
parent
6089c9d8
Changes
6
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
057ac066
*.elf
*.o
*.ihex
build-*
.gitmodules
0 → 100644
View file @
057ac066
[submodule "vendor/FastLED"]
path = vendor/FastLED
url = https://github.com/FastLED/FastLED.git
Makefile
View file @
057ac066
CC
=
avr-gcc
MMCU
=
atmega328p
CLOCK
=
16000000
USER_LIB_PATH
:=
$(
shell
pwd
)
/vendor
ARDUINO
=
/usr/share/arduino
ARDUINO_DIR
=
$(ARDUINO)
CFLAGS
:=
-std
=
gnu99
-Os
-Wall
-ffunction-sections
-fdata-sections
-mmcu
=
$(MMCU)
-DF_CPU
=
$(CLOCK)
LDFLAG
S
:
=
-Os
-mmcu
=
$(MMCU)
-ffunction-sections
-fdata-sections
-Wl
,--gc-sections
BOARD_TAG
=
uno
ARDUINO_LIB
S
=
FastLED
SOURCES
:=
$(
wildcard
src/
*
.c src/
*
/
*
.c
)
HEADERS
:=
$(
wildcard
src/
*
.h src/
*
/
*
.h
)
OBJECTS
:=
$(
subst
.c,.o,
$(
subst
src,build,
$(SOURCES)
))
.Phony
:
clean flash
default
:
shelf-lights.ihex
shelf-lights.ihex
:
shelf-lights.elf
avr-objcopy
-O
ihex
-R
.eeprom shelf-lights.elf shelf-lights.ihex
shelf-lights.elf
:
$(OBJECTS)
$(CC)
-o
$@
$(OBJECTS)
$(LDFLAGS)
$(OBJECTS)
:
./build/%.o: ./src/%.c
mkdir
-p
$
(
@D
)
$(CC)
-c
$<
-o
$@
$(CFLAGS)
flash
:
shelf-lights.ihex
avrdude
-C
/etc/avrdude.conf
-p
$(MMCU)
-c
arduino
-b
115200
-P
/dev/ttyUSB0
-U
flash:w:shelf-lights.ihex:i
clean
:
rm
-f
shelf-lights.elf
rm
-f
shelf-lights.ihex
rm
-rf
build
include
/usr/share/arduino/Arduino.mk
main.cpp
0 → 100644
View file @
057ac066
#include
<FastLED.h>
// How many leds in your strip?
#define NUM_LEDS 1
// For led chips like WS2812, which have a data line, ground, and power, you just
// need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
// ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN
// Clock pin only needed for SPI based chipsets when not using hardware SPI
#define DATA_PIN 3
// Define the array of leds
CRGB
leds
[
NUM_LEDS
];
void
setup
()
{
FastLED
.
addLeds
<
WS2813
,
DATA_PIN
,
RGB
>
(
leds
,
NUM_LEDS
);
}
void
loop
()
{
// Turn the LED on, then pause
leds
[
0
]
=
CRGB
::
Red
;
FastLED
.
show
();
delay
(
500
);
// Now turn the LED off, then pause
leds
[
0
]
=
CRGB
::
Black
;
FastLED
.
show
();
delay
(
500
);
}
src/main.c
deleted
100644 → 0
View file @
6089c9d8
#include
<avr/io.h>
//defines pins, ports etc
#include
<util/delay.h>
//functions for wasting time
int
main
(
void
)
{
//init
DDRB
|=
(
1
<<
PB5
);
//Data Direction Register B:
//writing a 1 to the Pin B5 bit enables output
//Event loop
while
(
1
)
{
PORTB
=
0
b00100000
;
//turn on 5th LED bit/pin in PORT B (Pin13 in Arduino)
_delay_ms
(
1000
);
//wait
PORTB
=
0
b00000000
;
//turn off all bits/pins on PB
_delay_ms
(
1000
);
//wait
}
//end loop
return
(
0
);
//end program. This never happens.
}
FastLED
@
8b387714
Subproject commit 8b3877143287ac3e5d63934d1c8271c54035f243
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment