servo geht
This commit is contained in:
parent
7b2e5aa1ef
commit
eaa8ca721a
207 changed files with 278 additions and 15300 deletions
30
control/examples/servo/Makefile
Normal file
30
control/examples/servo/Makefile
Normal file
|
@ -0,0 +1,30 @@
|
|||
# Name: Makefile
|
||||
# Project: B15F (board15 Famulus Edition)
|
||||
# Author: Tristan Krause
|
||||
# Creation Date: 2019-05-15
|
||||
|
||||
# Environment
|
||||
COMPILER_PATH = g++
|
||||
|
||||
# Options
|
||||
CFLAGS = -std=c++17 -O3 -Wall -Wextra
|
||||
LDFLAGS = -lb15fdrv
|
||||
OBJECTS = main.o
|
||||
OUT = main.elf
|
||||
|
||||
COMPILE = $(COMPILER_PATH) $(CFLAGS)
|
||||
|
||||
main: $(OBJECTS)
|
||||
$(COMPILE) $(OBJECTS) -o $(OUT) $(LDFLAGS)
|
||||
|
||||
help:
|
||||
@echo "This Makefile has the following targets:"
|
||||
@echo "make main .... to compile"
|
||||
@echo "make clean ... to delete objects and executables"
|
||||
|
||||
clean:
|
||||
@echo "Cleaning..."
|
||||
rm -f $(OBJECTS) $(OUT) *.bin gnuplotscript.gp
|
||||
|
||||
.cpp.o:
|
||||
$(COMPILE) -c $< -o $@
|
21
control/examples/servo/main.cpp
Normal file
21
control/examples/servo/main.cpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
#include <b15f/b15f.h>
|
||||
|
||||
/*
|
||||
* Dieses Beispiel steuert einen Servo an PB3 an.
|
||||
*
|
||||
*/
|
||||
int main()
|
||||
{
|
||||
B15F& drv = B15F::getInstance();
|
||||
|
||||
// aktiviere Servo Signal
|
||||
drv.setServoEnabled();
|
||||
|
||||
// drehe Servo
|
||||
drv.setServoPosition(1000);
|
||||
|
||||
drv.delay_ms(2000);
|
||||
|
||||
// drehe Servo
|
||||
drv.setServoPosition(19000);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue