Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BitS2 bare Minimum
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bits_libs
BitS2 bare Minimum
Merge requests
!4
Replace bits-bare-minimum-zyklus-1.ino
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Open
Replace bits-bare-minimum-zyklus-1.ino
nacharbeit-sakguel1/bits-bare-minimum:Nacharbeit
into
main
Overview
0
Commits
1
Pipelines
0
Changes
1
Open
Selcuk Tunahan Akgül
requested to merge
nacharbeit-sakguel1/bits-bare-minimum:Nacharbeit
into
main
11 months ago
Overview
0
Commits
1
Pipelines
0
Changes
1
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
95322857
1 commit,
11 months ago
1 file
+
149
−
111
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
bits-bare-minimum-zyklus-1.ino
+
149
−
111
View file @ 95322857
Edit in single-file editor
Open in Web IDE
/***************************************************
/***************************************************
________ ___ _________ ________ _______
________ ___ _________ ________ _______
|\ __ \|\ \|\___ ___\\ ____\ / ___ \
|\ __ \|\ \|\___ ___\\ ____\ / ___ \
\ \ \|\ /\ \ \|___ \ \_\ \ \___|_/__/|_/ /|
\ \ \|\ /\ \ \|___ \ \_\ \ \___|_/__/|_/ /|
\ \ __ \ \ \ \ \ \ \ \_____ \__|// / /
\ \ __ \ \ \ \ \ \ \ \_____ \__|// / /
\ \ \|\ \ \ \ \ \ \ \|____|\ \ / /_/__
\ \ \|\ \ \ \ \ \ \ \|____|\ \ / /_/__
\ \_______\ \__\ \ \__\ ____\_\ \|\________\
\ \_______\ \__\ \ \__\ ____\_\ \|\________\
\|_______|\|__| \|__| |\_________\\|_______|
\|_______|\|__| \|__| |\_________\\|_______|
\|_________|
\|_________|
Name:
Name:
<Hier kommt der Name des Projekts>
<Hier kommt der Name des Projekts>
Description:
Description:
<Hier kommt was dieses Skript macht>
<Hier kommt was dieses Skript macht>
Author:
Author:
<Hier Namen einfügen>
<Hier Namen einfügen>
**************************************************/
**************************************************/
#define DEBUG_SERIAL
#define DEBUG_SERIAL
// #define WIFI_COMMUNICATION
// #define WIFI_COMMUNICATION
#ifdef DEBUG_SERIAL
#ifdef DEBUG_SERIAL
#define _println_(x) Serial.println(x)
#define _println_(x) Serial.println(x)
#define _print_(x) Serial.print(x)
#define _print_(x) Serial.print(x)
#else
#else
#ifdef WIFI_COMMUNICATION
#ifdef WIFI_COMMUNICATION
#define _println_(x) Serial3.println(x)
#define _println_(x) Serial3.println(x)
#define _print_(x) Serial3.print(x)
#define _print_(x) Serial3.print(x)
#else
#else
#define _println_(x)
#define _println_(x)
#define _print_(x)
#define _print_(x)
#endif
#endif
#endif
#endif
#include
"config.h"
#include
"config.h"
#include
"basic_functions.h"
#include
"basic_functions.h"
#include
"custom_config.h"
#include
"custom_config.h"
#include
"custom_functions.h"
#include
"custom_functions.h"
void
setup
(){
void
setup
(){
// Hier wird entschieden wie die Serielle Kommunikation vom Mega erfolgen soll. Weiteres siehe in config.h
// Hier wird entschieden wie die Serielle Kommunikation vom Mega erfolgen soll. Weiteres siehe in config.h
#ifdef DEBUG_SERIAL
#ifdef DEBUG_SERIAL
Serial
.
begin
(
115200
);
Serial
.
begin
(
115200
);
#endif
#endif
#ifdef WIFI_COMMUNICATION
#ifdef WIFI_COMMUNICATION
Serial3
.
begin
(
115200
);
Serial3
.
begin
(
115200
);
#endif
#endif
// Initialisierung der optischen Time-of-Flight Sensoren
// Initialisierung der optischen Time-of-Flight Sensoren
tof_controller
.
init
();
tof_controller
.
init
();
// Starten der I2C Kommunikation
// Starten der I2C Kommunikation
Wire
.
begin
();
Wire
.
begin
();
Wire
.
setClock
(
400000
);
// 400kHz I2C clock. Comment this line if having compilation difficulties
Wire
.
setClock
(
400000
);
// 400kHz I2C clock. Comment this line if having compilation difficulties
// Initialisierung der LED-Streifen
// Initialisierung der LED-Streifen
front_strip
.
init
();
front_strip
.
init
();
back_strip
.
init
();
back_strip
.
init
();
left_strip
.
init
();
left_strip
.
init
();
right_strip
.
init
();
right_strip
.
init
();
// Initialisierung der IMU inkl. Lichtspiel
// Initialisierung der IMU inkl. Lichtspiel
imu
.
init
();
imu
.
init
();
start
=
millis
();
start
=
millis
();
_println_
(
"Waiting for IMU getting ready. Please do not move the car!"
);
_println_
(
"Waiting for IMU getting ready. Please do not move the car!"
);
_print_
(
"Waiting"
);
_print_
(
"Waiting"
);
set_led_color
(
255
,
0
,
0
);
set_led_color
(
255
,
0
,
0
);
for
(
int
k
=
0
;
k
<
13
;
k
++
){
for
(
int
k
=
0
;
k
<
13
;
k
++
){
for
(
int
i
=
0
;
i
<
FRONT_LED_NUM
;
i
++
){
for
(
int
i
=
0
;
i
<
FRONT_LED_NUM
;
i
++
){
front_strip
.
set_pixel_color
(
i
,
thk_LedStripController
::
Color
(
red
,
green
,
blue
));
front_strip
.
set_pixel_color
(
i
,
thk_LedStripController
::
Color
(
red
,
green
,
blue
));
front_strip
.
show
();
front_strip
.
show
();
delay
(
500
/
FRONT_LED_NUM
);
delay
(
500
/
FRONT_LED_NUM
);
_print_
(
"."
);
_print_
(
"."
);
}
}
for
(
int
i
=
0
;
i
<
FRONT_LED_NUM
;
i
++
){
for
(
int
i
=
0
;
i
<
FRONT_LED_NUM
;
i
++
){
front_strip
.
set_pixel_color
(
i
,
thk_LedStripController
::
Color
(
0
,
0
,
0
));
front_strip
.
set_pixel_color
(
i
,
thk_LedStripController
::
Color
(
0
,
0
,
0
));
front_strip
.
show
();
front_strip
.
show
();
delay
(
500
/
FRONT_LED_NUM
);
delay
(
500
/
FRONT_LED_NUM
);
_print_
(
"."
);
_print_
(
"."
);
}
}
red
-=
20
;
red
-=
20
;
green
+=
20
;
green
+=
20
;
}
}
// Pin deklaration der Ultraschallsensoren
// Pin deklaration der Ultraschallsensoren
pinMode
(
TRIGF
,
OUTPUT
);
pinMode
(
TRIGF
,
OUTPUT
);
pinMode
(
TRIGB
,
OUTPUT
);
pinMode
(
TRIGB
,
OUTPUT
);
pinMode
(
ECHOF
,
INPUT
);
pinMode
(
ECHOF
,
INPUT
);
pinMode
(
ECHOB
,
INPUT
);
pinMode
(
ECHOB
,
INPUT
);
// Initialisierung des Motors
// Initialisierung des Motors
Motor
.
init
();
Motor
.
init
();
// Initialisierung der Servomotoren
// Initialisierung der Servomotoren
ServoSteer
.
begin
();
ServoSteer
.
begin
();
ServoSearch
.
begin
();
ServoSearch
.
begin
();
// Initialisierung abgeschlossen
// Initialisierung abgeschlossen
_println_
(
"Ready!"
);
_println_
(
"Ready!"
);
buzzer_signal
(
350
,
2
,
100
);
buzzer_signal
(
350
,
2
,
100
);
set_led_color
(
0
,
100
,
0
);
set_led_color
(
0
,
100
,
0
);
all_led_blink
(
2
,
200
);
all_led_blink
(
2
,
200
);
}
}
void
loop
(){
void
loop
(){
//SENSORDATEN AUSLESEN
}
int
TOF0
=
tof_controller
.
get_distance_cm
(
0
);
int
TOF1
=
tof_controller
.
get_distance_cm
(
1
);
int
TOF2
=
tof_controller
.
get_distance_cm
(
2
);
int
TOF3
=
tof_controller
.
get_distance_cm
(
3
);
int
TOF4
=
tof_controller
.
get_distance_cm
(
4
);
int
US1
=
us_get_distance
(
TRIGF
,
ECHOF
);
int
US2
=
us_get_distance
(
TRIGB
,
ECHOB
);
//TOF Sensor
Serial
.
print
(
TOF0
);
Serial
.
print
(
" cm"
);
Serial
.
print
(
"
\t
"
);
Serial
.
print
(
TOF1
);
Serial
.
print
(
" cm"
);
Serial
.
print
(
"
\t
"
);
Serial
.
print
(
TOF2
);
Serial
.
print
(
" cm"
);
Serial
.
print
(
"
\t
"
);
Serial
.
print
(
TOF3
);
Serial
.
print
(
" cm"
);
Serial
.
print
(
"
\t
"
);
Serial
.
print
(
TOF4
);
Serial
.
println
(
" cm"
);
//Ultraschallsensor
Serial
.
print
(
US1
);
Serial
.
print
(
" cm"
);
Serial
.
print
(
"
\t
"
);
Serial
.
print
(
US2
);
Serial
.
print
(
" cm"
);
Serial
.
print
(
"
\t
"
);
Serial
.
print
(
"
\t
"
);
Serial
.
print
(
"
\t
"
);
}
Loading