mirror of
https://gitlab.dit.htwk-leipzig.de/phillip.kuehne/dezibot.git
synced 2025-05-28 07:21:47 +02:00
added start example
This commit is contained in:
parent
0ca8ab255b
commit
dbec7278f3
39
README.md
39
README.md
@ -106,6 +106,8 @@ A german documentation will be provided but does not replace the english documen
|
||||
|
||||
### Documentation
|
||||
|
||||
Documentation of the Software and Hardware can be found at https://docs.dezibot.de/
|
||||
|
||||
#### .h Files
|
||||
|
||||
```C++
|
||||
@ -142,7 +144,6 @@ For instance, in `src/Dezibot.h`, to include `src/motion/Motion.h`, you should w
|
||||
* Upload Mode: "UART0 / Hardware CDC"
|
||||
* USB Mode: "Hardware CDC and JTAG"
|
||||
* Programmer: "Esptool"
|
||||
* USB CDC on Boot: Enabled
|
||||
|
||||
Using `arduino-cli` to compile and upload:
|
||||
`arduino-cli upload /Users/jo/Documents/Arduino/theSketch -p /dev/cu.usbmodem101 -b esp32:esp32:nora_w10`
|
||||
@ -152,40 +153,12 @@ Using `arduino-cli` to compile and upload:
|
||||
|
||||
Arduino IDE -> Sketch -> Include Library -> add .ZIP Library -> this library
|
||||
|
||||
If there is any other error like 'Adafruit_SSD1306' not found, you have to include this library also.
|
||||
If there is any other error like 'Painless_Mesh' not found, you have to include this library also.
|
||||
|
||||
Arduino IDE -> Sketch -> Manage Library -> Search for missing Library
|
||||
|
||||
#### Display
|
||||
#### Start from Scratch
|
||||
|
||||
It is important to specify the SDA and SCL ports by using `Wire.begin(SDA, SCL)`.
|
||||
It is important, before using any functions of Dezibot, to call ```dezibot.begin()``` once in the setup function.
|
||||
|
||||
```c++
|
||||
#include <Wire.h>
|
||||
#include <Adafruit_SSD1306.h>
|
||||
|
||||
#define SCREEN_WIDTH 128
|
||||
#define SCREEN_HEIGHT 64
|
||||
|
||||
#define OLED_RESET -1
|
||||
#define SCREEN_ADDRESS 0x3C
|
||||
|
||||
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
|
||||
|
||||
void Dezibot::begin(void) {
|
||||
Wire.begin(1, 2);
|
||||
if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
|
||||
// Serial.println("SSD1306 allocation failed");
|
||||
for (;;); // Don't proceed, loop forever
|
||||
}
|
||||
|
||||
|
||||
// Draw a single pixel in white
|
||||
display.drawPixel(10, 10, SSD1306_WHITE);
|
||||
|
||||
// Show the display buffer on the screen. You MUST call display() after
|
||||
// drawing commands to make them visible on screen!
|
||||
display.display();
|
||||
vTaskDelay(2000);
|
||||
}
|
||||
```
|
||||
In the examples folder, a sketch ``start`` is provided, that handles the initialization.
|
Loading…
x
Reference in New Issue
Block a user