From 8ee854fae46a994b1798c983642644ef55d6b568 Mon Sep 17 00:00:00 2001 From: Benedikt Isken <benedikt.isken@th-koeln.de> Date: Wed, 7 May 2025 13:36:32 +0200 Subject: [PATCH] Fix: ino Namen angepasst, led Lichtspiel in eigene Funktion, ino aufgeraeumt --- README.md | 8 ++-- ...omatischer BITS_Bibliotheken Downloader.sh | 9 +++-- basic_functions.h | 29 ++++++++++++++ ...imum-zyklus-1.ino => bits-bare-minimum.ino | 39 ++----------------- config.h | 16 ++++++++ custom_functions.h | 5 --- 6 files changed, 59 insertions(+), 47 deletions(-) rename bits-bare-minimum-zyklus-1.ino => bits-bare-minimum.ino (68%) diff --git a/README.md b/README.md index c7aa39e..be8f445 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# **BITS-i Bare Minimum Zyklus 1** +# **BITS-i Bare Minimum** Dieses Projekt dient als Grundlage für alle Projekte mit BITS-i.<br /> <br /> @@ -11,14 +11,14 @@ Folgende Bibliotheken inklusive der jeweiligen Voraussetzungen sind für dieses - [bits_time_of_flight_controller](https://git-ce.rwth-aachen.de/bits/bits_libs/bits_time_of_flight_controller.git) - [thk_led_strip_controller](https://git-ce.rwth-aachen.de/thk_libs/microcontrollers/thk-led-strip-controller.git) - [thk_imu](https://git-ce.rwth-aachen.de/thk_libs/microcontrollers/thk_imu.git) -- [bits_motor_driver ](https://git-ce.rwth-aachen.de/bits/bits_libs/bits_motor_driver.git) +- [bits_motor_driver](https://git-ce.rwth-aachen.de/bits/bits_libs/bits_motor_driver.git) - [RF24 by TMRh20](https://github.com/nRF24/RF24)<br /> <br /> ## **Installation:** -Um dieses Projekt verwenden können, muss dieses Repository geklont und die `bits-bare-minimum-zyklus-1.ino` mit der Arduino IDE geöffnet werden. -Es muss darauf geachtet werden, dass der Ordner, in dem sich die `bits-bare-minimum-zyklus-1.ino` befindet, `bits-bare-minimum-zyklus-1` lautet. +Um dieses Projekt verwenden können, muss dieses Repository geklont und die `bits-bare-minimum.ino` mit der Arduino IDE geöffnet werden. +Es muss darauf geachtet werden, dass der Ordner, in dem sich die `bits-bare-minimum.ino` befindet, `bits-bare-minimum` lautet. ## **Anwendung:** diff --git a/Tools/Automatischer BITS_Bibliotheken Downloader.sh b/Tools/Automatischer BITS_Bibliotheken Downloader.sh index 89cab73..d2a2ff6 100644 --- a/Tools/Automatischer BITS_Bibliotheken Downloader.sh +++ b/Tools/Automatischer BITS_Bibliotheken Downloader.sh @@ -3,6 +3,7 @@ RED='\033[0;31m' GREEN='\033[0;32m' NOCOLOR='\033[0m' +REDBACKGROUND='\033[31;7m' bold=$(tput bold) normal=$(tput sgr0) @@ -24,10 +25,12 @@ echo -e "$RED" echo -e "__________________________________________________________________" echo -e "__________________________________________________________________" echo -e " " -echo -e "\033[31;7m${bold}WICHTIG!!!!!\033[0m" +echo -e "$REDBACKGROUND${bold}" +echo -e 'WICHTIG!!!!!' +echo -e "$NOCOLOR" echo -e " " -echo -e "\033[31;7m${bold}Bitte entzippen Sie die Datei und kopieren Sie " -echo -e "alle Ordner aus BITS_Bibliotheken in den Arduino Libraries Ordner\033[0m" +echo -e "$REDBACKGROUND${bold}Bitte entzippen Sie die Datei und kopieren Sie " +echo -e "alle Ordner aus BITS_Bibliotheken in den Arduino Libraries Ordner." echo -e "$RED" echo -e "__________________________________________________________________" echo -e "__________________________________________________________________" diff --git a/basic_functions.h b/basic_functions.h index b8eff12..2cb1197 100644 --- a/basic_functions.h +++ b/basic_functions.h @@ -113,4 +113,33 @@ void end_of_programm(){ } } +void initial_led_show() { + _println_("Waiting"); + set_led_color(255,0,0); + const int frequencySteps[] = {500, 700, 900, 1100, 900, 700}; + int counter = 0; + for (int k=0; k<13; k++){ + for (int i=0; i<FRONT_LED_NUM; i++){ + front_strip.set_pixel_color(i,thk_LedStripController::Color(red, green, blue)); + front_strip.show(); + tone(BUZZER_PIN, frequencySteps[counter%6], 500/FRONT_LED_NUM); + delay(500/FRONT_LED_NUM); + _print_("."); + counter++; + } + for (int i=0; i<FRONT_LED_NUM; i++){ + front_strip.set_pixel_color(i,thk_LedStripController::Color(0, 0, 0)); + front_strip.show(); + tone(BUZZER_PIN, frequencySteps[counter%6], 500/FRONT_LED_NUM); + delay(500/FRONT_LED_NUM); + _print_("."); + counter++; + } + red -= 20; + green += 20; + counter++; + } + noTone(BUZZER_PIN); +} + #endif \ No newline at end of file diff --git a/bits-bare-minimum-zyklus-1.ino b/bits-bare-minimum.ino similarity index 68% rename from bits-bare-minimum-zyklus-1.ino rename to bits-bare-minimum.ino index 15066f2..e620883 100644 --- a/bits-bare-minimum-zyklus-1.ino +++ b/bits-bare-minimum.ino @@ -12,28 +12,12 @@ <Hier kommt der Name des Projekts> Description: - <Hier kommt was dieses Skript macht> + <Hier wird die Funktion dieses Skripts beschrieben> - Author: <Hier Namen einfügen> **************************************************/ -#define DEBUG_SERIAL -// #define WIFI_COMMUNICATION - -#ifdef DEBUG_SERIAL -#define _println_(x) Serial.println(x) -#define _print_(x) Serial.print(x) -#else -#ifdef WIFI_COMMUNICATION -#define _println_(x) Serial3.println(x) -#define _print_(x) Serial3.print(x) -#else -#define _println_(x) -#define _print_(x) -#endif -#endif #include "config.h" #include "basic_functions.h" @@ -66,24 +50,9 @@ void setup(){ imu.init(); start = millis(); _println_("Waiting for IMU getting ready. Please do not move the car!"); - _print_("Waiting"); - set_led_color(255,0,0); - for (int k=0; k<13; k++){ - for (int i=0; i<FRONT_LED_NUM; i++){ - front_strip.set_pixel_color(i,thk_LedStripController::Color(red, green, blue)); - front_strip.show(); - delay(500/FRONT_LED_NUM); - _print_("."); - } - for (int i=0; i<FRONT_LED_NUM; i++){ - front_strip.set_pixel_color(i,thk_LedStripController::Color(0, 0, 0)); - front_strip.show(); - delay(500/FRONT_LED_NUM); - _print_("."); - } - red -= 20; - green += 20; - } + + //Spätestens vor der letzten Abgabe auskommentieren, da sehr viel Zeit dabei verloren geht! + initial_led_show(); // Pin deklaration der Ultraschallsensoren pinMode(TRIGF, OUTPUT); diff --git a/config.h b/config.h index e06bcbe..e91d48d 100644 --- a/config.h +++ b/config.h @@ -41,6 +41,22 @@ // #define DEBUG_IMU // #define DEBUG_COURSE +#define DEBUG_SERIAL +// #define WIFI_COMMUNICATION + +#ifdef DEBUG_SERIAL +#define _println_(x) Serial.println(x) +#define _print_(x) Serial.print(x) +#else +#ifdef WIFI_COMMUNICATION +#define _println_(x) Serial3.println(x) +#define _print_(x) Serial3.print(x) +#else +#define _println_(x) +#define _print_(x) +#endif +#endif + /* ************ * * Bibliotheken * * ************ */ diff --git a/custom_functions.h b/custom_functions.h index 16253e3..d172493 100644 --- a/custom_functions.h +++ b/custom_functions.h @@ -5,9 +5,4 @@ void platzhalter(){ // Dies ist nur ein Platzhalter. } - - - - - #endif \ No newline at end of file -- GitLab