first commit

This commit is contained in:
2022-10-31 12:38:30 +01:00
commit 434c3444c0
8 changed files with 566 additions and 0 deletions

5
.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch

7
.vscode/extensions.json vendored Normal file
View File

@@ -0,0 +1,7 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
]
}

0
README.md Normal file
View File

39
include/README Normal file
View File

@@ -0,0 +1,39 @@
This directory is intended for project header files.
A header file is a file containing C declarations and macro definitions
to be shared between several project source files. You request the use of a
header file in your project source file (C, C++, etc) located in `src` folder
by including it, with the C preprocessing directive `#include'.
```src/main.c
#include "header.h"
int main (void)
{
...
}
```
Including a header file produces the same results as copying the header file
into each source file that needs it. Such copying would be time-consuming
and error-prone. With a header file, the related declarations appear
in only one place. If they need to be changed, they can be changed in one
place, and programs that include the header file will automatically use the
new version when next recompiled. The header file eliminates the labor of
finding and changing all the copies as well as the risk that a failure to
find one copy will result in inconsistencies within a program.
In C, the usual convention is to give header files names that end with `.h'.
It is most portable to use only letters, digits, dashes, and underscores in
header file names, and at most one dot.
Read more about using header files in official GCC documentation:
* Include Syntax
* Include Operation
* Once-Only Headers
* Computed Includes
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html

46
lib/README Normal file
View File

@@ -0,0 +1,46 @@
This directory is intended for project specific (private) libraries.
PlatformIO will compile them to static libraries and link into executable file.
The source code of each library should be placed in a an own separate directory
("lib/your_library_name/[here are source files]").
For example, see a structure of the following two libraries `Foo` and `Bar`:
|--lib
| |
| |--Bar
| | |--docs
| | |--examples
| | |--src
| | |- Bar.c
| | |- Bar.h
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
| |
| |--Foo
| | |- Foo.c
| | |- Foo.h
| |
| |- README --> THIS FILE
|
|- platformio.ini
|--src
|- main.c
and a contents of `src/main.c`:
```
#include <Foo.h>
#include <Bar.h>
int main (void)
{
...
}
```
PlatformIO Library Dependency Finder will find automatically dependent
libraries scanning project source files.
More information about PlatformIO Library Dependency Finder
- https://docs.platformio.org/page/librarymanager/ldf.html

19
platformio.ini Normal file
View File

@@ -0,0 +1,19 @@
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:uno]
platform = atmelavr
board = uno
framework = arduino
lib_deps =
adafruit/Adafruit GFX Library@^1.10.12
adafruit/Adafruit BusIO@^1.9.3
adafruit/Adafruit SSD1306@^2.4.7
adafruit/Adafruit SH1106@

439
src/main.cpp Normal file
View File

@@ -0,0 +1,439 @@
#include <Arduino.h>
#include <Wire.h>
#include <Adafruit_SH1106.h>
#include <Adafruit_GFX.h>
#define OLED_RESET -1
Adafruit_SH1106 display(OLED_RESET);
int AlkPin=A1;
int ButtonPin=4; //I2C SDA->A4 SCL->A5
int RedPin=13;
int GreenPin=12;
int BluePin=11;
int BuzzPin=10;
int AlkVal;
int MaxAlkVal;
int AlkSum;
int AlkMean;
int ButtonVal;
int i;
int j;
int Bier;
int Aufwaermzeit = 10;
int Messzeit = 10;
int time;
int time2;
// 'Wolfi128x64', 128x64px
const unsigned char BitmapWolfi [] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xbc, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xfe, 0x80, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x02, 0x3f, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x1e, 0x1f, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x3f, 0xcf, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x3c, 0x00, 0x3f, 0xe7, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x58, 0x00, 0x7f, 0xb0, 0x3f, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0xb8, 0x01, 0xfe, 0x0c, 0x1f, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0xb0, 0x01, 0xfe, 0x06, 0x07, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x03, 0xfe, 0x20, 0x03, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x07, 0xff, 0xa0, 0x03, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x0f, 0xff, 0xff, 0x03, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0xff, 0xff, 0x97, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x07, 0xff, 0xff, 0x3f, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x0f, 0xff, 0xfe, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xec, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xcf, 0x60, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xcf, 0xe0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xcf, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0x8f, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0x8f, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0x8f, 0xc0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0x1f, 0xe0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xf1, 0xff, 0x1f, 0xe0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xef, 0xff, 0x3f, 0xc0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xef, 0xfe, 0x3f, 0xc0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xef, 0xfe, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x1f, 0xff, 0xff, 0xfe, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xfe, 0xfe, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xfe, 0x7c, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x1f, 0xff, 0xff, 0x39, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x1f, 0xc1, 0xff, 0xc1, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x0b, 0x7f, 0xe1, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0xe3, 0xe1, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x1f, 0xfc, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x3f, 0x1f, 0xff, 0x83, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x9f, 0xff, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x9f, 0xf8, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0x1f, 0xfc, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xbf, 0xfe, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xbf, 0xfe, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x10, 0x00, 0x01, 0xff, 0xbf, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0xff, 0x3f, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xff, 0x7f, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x03, 0xff, 0xc0, 0x00, 0xff, 0x7f, 0xfe, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x07, 0xff, 0xf0, 0x00, 0x3f, 0x7f, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x07, 0xff, 0xf8, 0x00, 0x3f, 0x7f, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0f, 0xff, 0xff, 0x00, 0x1f, 0x7f, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1f, 0xff, 0xff, 0x80, 0x0f, 0x3f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3f, 0xff, 0xff, 0xc0, 0x07, 0xbf, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3f, 0xff, 0xff, 0x80, 0x07, 0x9f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7f, 0xff, 0xff, 0xe0, 0x03, 0xdf, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0xff, 0xff, 0xf0, 0x01, 0xcf, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
void Startbildschirm(){
display.clearDisplay(); //Display löschen
display.setTextColor(WHITE); //Textfarbe
display.setTextSize(2); //Textgröße
display.setCursor(0,0);
display.setCursor(20,5);
display.print("WOLFI'S");
display.setCursor(18,35);
display.print("Sudmeter");
display.display();
for(j=0; j<3; j=j+1){
digitalWrite(BuzzPin,HIGH);
digitalWrite(GreenPin,HIGH);
delay(300);
digitalWrite(BuzzPin,LOW);
digitalWrite(GreenPin,LOW);
delay(300);
}
}
void Foto(){
display.clearDisplay();
display.drawBitmap(0,0,BitmapWolfi,128,64,WHITE);
display.display();
}
void Aufwaermen(){
display.clearDisplay();
time = map(time, 0, Aufwaermzeit, 0, 100);
display.setTextColor(WHITE); //Textfarbe
display.setTextSize(1); //Textgröße
display.setCursor(25,20);
display.print("Aufwaermen...");
display.drawRect(10, 50, 110, 10, WHITE); //Empty Bar
display.fillRect(10, 50, time,10,WHITE);
display.display();
}
void Messbildschirm(){
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(2);
display.setCursor(33,10);
display.print("Start");
display.setTextSize(1);
display.setCursor(23,40);
display.print("Knopf druecken");
display.display();
}
void Messung(){
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(2);
display.setCursor(35,5);
display.print("3 Mal");
display.setCursor(23,35);
display.print("hauchen");
display.setTextSize(1);
display.setCursor(18,43);
display.print("15 cm Entfernung");
display.display();
}
void Ausgabe(){
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(2);
display.setCursor(30,5);
display.print("Status: ");
display.setCursor(30,30);
display.print(Bier);
display.print(" Bier");
display.setCursor(40,50);
display.setTextSize(1);
display.print(AlkMean);
display.display();
if(Bier==0){
digitalWrite(BuzzPin,HIGH);
digitalWrite(GreenPin,HIGH);
delay(1000);
digitalWrite(BuzzPin,LOW);
digitalWrite(GreenPin,LOW);
} else if (Bier==1){
digitalWrite(BuzzPin,HIGH);
digitalWrite(GreenPin,HIGH);
delay(1000);
digitalWrite(BuzzPin,LOW);
digitalWrite(GreenPin,LOW);
} else if (Bier==2){
digitalWrite(BuzzPin,HIGH);
digitalWrite(GreenPin,HIGH);
delay(1000);
digitalWrite(BuzzPin,LOW);
digitalWrite(GreenPin,LOW);
} else if (Bier==3){
for(j=0; j<3; j=j+1){
digitalWrite(BuzzPin,HIGH);
digitalWrite(BluePin,HIGH);
delay(300);
digitalWrite(BuzzPin,LOW);
digitalWrite(BluePin,LOW);
delay(300);
}
} else if (Bier==4){
for(j=0; j<3; j=j+1){
digitalWrite(BuzzPin,HIGH);
digitalWrite(BluePin,HIGH);
delay(300);
digitalWrite(BuzzPin,LOW);
digitalWrite(BluePin,LOW);
delay(300);
}
} else if (Bier==5){
for(j=0; j<3; j=j+1){
digitalWrite(BuzzPin,HIGH);
digitalWrite(BluePin,HIGH);
delay(300);
digitalWrite(BuzzPin,LOW);
digitalWrite(BluePin,LOW);
delay(300);
}
} else if (Bier==6){
for(j=0; j<6; j=j+1){
digitalWrite(BuzzPin,HIGH);
digitalWrite(RedPin,HIGH);
delay(100);
digitalWrite(BuzzPin,LOW);
digitalWrite(RedPin,LOW);
delay(100);
}
} else if (Bier==7){
for(j=0; j<6; j=j+1){
digitalWrite(BuzzPin,HIGH);
digitalWrite(RedPin,HIGH);
delay(100);
digitalWrite(BuzzPin,LOW);
digitalWrite(RedPin,LOW);
delay(100);
}
} else if (Bier==8){
for(j=0; j<6; j=j+1){
digitalWrite(BuzzPin,HIGH);
digitalWrite(RedPin,HIGH);
delay(100);
digitalWrite(BuzzPin,LOW);
digitalWrite(RedPin,LOW);
delay(100);
}
} else if (Bier==9){
for(j=0; j<6; j=j+1){
digitalWrite(BuzzPin,HIGH);
digitalWrite(RedPin,HIGH);
delay(100);
digitalWrite(BuzzPin,LOW);
digitalWrite(RedPin,LOW);
delay(100);
}
} else if (Bier==10){
digitalWrite(BuzzPin,HIGH);
digitalWrite(RedPin,HIGH);
delay(2000);
digitalWrite(BuzzPin,LOW);
digitalWrite(RedPin,LOW);
}
}
void Berechnung(){
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(2);
display.setCursor(15,5);
display.print("Berechne");
display.setTextSize(2);
display.setCursor(15,35);
display.print("Sudlevel");
display.display();
}
void Message(){
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(2);
display.setCursor(0,0);
if(Bier==0){
display.print("Sauf amal was du");
display.setCursor(0,35);
display.print("Muschi!");
} else if (Bier==1){
display.print("Oans geahtalm");
} else if (Bier==2){
display.print("Nach dem ");
display.setCursor(0,17);
display.print("geah i");
display.setCursor(0,35);
display.print("hoam");
} else if (Bier==3){
display.print("I geah");
display.setCursor(0,17);
display.print("jetzt hoam");
} else if (Bier==4){
display.print("Mei Vater");
display.setCursor(0,17);
display.print("hat ah");
display.setCursor(0,35);
display.print("a Glatzn");
} else if (Bier==5){
display.print("Yeeeaaah, du bisch ");
display.setCursor(0,30);
display.print("so cool,");
display.setCursor(0,45);
display.print("Hangl");
} else if (Bier==6){
display.print("Halt dei");
display.setCursor(0,17);
display.print("scheiss");
display.setCursor(0,35);
display.print("Maul");
} else if (Bier==7){
display.print("Jaeger-");
display.setCursor(0,17);
display.print("Meister");
display.setCursor(0,35);
display.print("Inc.");
} else if (Bier==8){
display.print("Rosenheim");
display.setCursor(0,17);
display.print("Inc.");
} else if (Bier==9){
display.print("Berchtes-");
display.setCursor(0,17);
display.print("gaden");
display.setCursor(0,35);
display.print("Inc.");
} else if (Bier==10){
display.print("Bettl-");
display.setCursor(0,17);
display.print("Ownage");
display.setCursor(0,35);
display.print("Inc.");
}
display.display();
}
void setup() {
Wire.begin(); //Wire-Library für I2C starten
display.begin(SH1106_SWITCHCAPVCC, 0x3C); //Oled-Display mit I2C Adresse initialisieren
pinMode(AlkPin,INPUT);
pinMode(ButtonPin,INPUT);
pinMode(RedPin,OUTPUT);
pinMode(GreenPin,OUTPUT);
pinMode(BluePin,OUTPUT);
pinMode(BuzzPin,OUTPUT);
digitalWrite(ButtonPin,HIGH);
Serial.begin(9600);
Startbildschirm();
delay(3000);
Foto();
delay(3000);
time = millis()/1000;
while(time<=Aufwaermzeit){
Aufwaermen();
time = millis()/1000;
}
}
void loop(){
AlkVal=0;
MaxAlkVal=0;
AlkSum=0;
i=0;
Messbildschirm();
ButtonVal=digitalRead(ButtonPin);
while(ButtonVal==1){
ButtonVal=digitalRead(ButtonPin);
}
digitalWrite(BuzzPin,HIGH);
digitalWrite(GreenPin,HIGH);
delay(300);
digitalWrite(BuzzPin,LOW);
digitalWrite(GreenPin,LOW);
time2 = millis()/1000;
Messzeit = time2+8;
while(time2<=Messzeit){
Messung();
AlkVal=analogRead(AlkPin);
AlkSum=AlkSum+AlkVal;
i=i+1;
time2 = millis()/1000;
Serial.println(AlkVal);
delay(500);
}
AlkMean=AlkSum/i;
if(AlkMean<140){
Bier=0;
}else if (AlkMean<180){
Bier=1;
}else if (AlkMean<220){
Bier=2;
}else if (AlkMean<260){
Bier=3;
}else if (AlkMean<300){
Bier=4;
}else if (AlkMean<340){
Bier=5;
}else if (AlkMean<380){
Bier=6;
}else if (AlkMean<420){
Bier=7;
}else if (AlkMean<460){
Bier=8;
}else if (AlkMean<500){
Bier=9;
}else if (AlkMean<1000){
Bier=10;
}
digitalWrite(BuzzPin,HIGH);
digitalWrite(RedPin,HIGH);
delay(300);
digitalWrite(BuzzPin,LOW);
digitalWrite(RedPin,LOW);
Berechnung();
delay(3000);
Ausgabe();
delay(5000);
Message();
delay(10000);
}

11
test/README Normal file
View File

@@ -0,0 +1,11 @@
This directory is intended for PlatformIO Unit Testing and project tests.
Unit Testing is a software testing method by which individual units of
source code, sets of one or more MCU program modules together with associated
control data, usage procedures, and operating procedures, are tested to
determine whether they are fit for use. Unit testing finds problems early
in the development cycle.
More information about PlatformIO Unit Testing:
- https://docs.platformio.org/page/plus/unit-testing.html