Skip to content

Commit 196d2f6

Browse files
committed
Examples back
1 parent 9847608 commit 196d2f6

File tree

361 files changed

+96966
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

361 files changed

+96966
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
Inkplate_Battery_Voltage_And_Temperature example for e-radionica Inkplate 6COLOR
3+
For this example you will need USB cable, Inkplate 6COLOR and a Lithium battery (3.6V) with two pin JST connector.
4+
Select "Inkplate 6COLOR(ESP32)" from Tools -> Board menu.
5+
Don't have "Inkplate 6COLOR(ESP32)" option? Follow our tutorial and add it:
6+
https://e-radionica.com/en/blog/add-inkplate-6-to-arduino-ide/
7+
8+
This example will show you how to read voltage of the battery and read temperature from on-board
9+
temperature sensor which is part of TPS65186 e-paper PMIC.
10+
NOTE: In order to read temperature, e-paper has to be refreshed at least one time,
11+
or you have to power up epaper PMIC with einkOn() function from Inkplate library.
12+
13+
Want to learn more about Inkplate? Visit www.inkplate.io
14+
Looking to get support? Write on our forums: http://forum.e-radionica.com/en/
15+
15 July 2020 by e-radionica.com
16+
*/
17+
18+
// Next 3 lines are a precaution, you can ignore those, and the example would also work without them
19+
#ifndef ARDUINO_INKPLATECOLOR
20+
#error "Wrong board selection for this example, please select Inkplate color in the boards menu."
21+
#endif
22+
23+
#include "Inkplate.h" //Include Inkplate library to the sketch
24+
#include "symbols.h" //Include .h file that contains byte array for battery symbol and temperature symbol.
25+
// It is in same folder as this sketch. You can even open it (read it) by clicking on symbols.h tab in Arduino IDE
26+
Inkplate display; // Create an object on Inkplate library
27+
28+
void setup()
29+
{
30+
Serial.begin(115200);
31+
display.begin(); // Init Inkplate library (you should call this function ONLY ONCE)
32+
33+
display.clearDisplay(); // Clear frame buffer of display
34+
display.display(); // Put clear image on display
35+
}
36+
37+
void loop()
38+
{
39+
float voltage;
40+
41+
voltage =
42+
display.readBattery(); // Read battery voltage (NOTE: Doe to ESP32 ADC accuracy, you should calibrate the ADC!)
43+
44+
display.clearDisplay(); // Clear everything in frame buffer of e-paper display
45+
display.drawBitmap(100, 100, battSymbol, battSymbol_w, battSymbol_h, INKPLATE_BLUE); // Draw battery symbol at position X=100 Y=100
46+
display.setCursor(210, 120);
47+
display.setTextColor(INKPLATE_BLUE);
48+
display.setTextSize(3);
49+
display.print(voltage, 2); // Print battery voltage
50+
display.print('V');
51+
52+
display.display(); // Send everything to display (refresh the screen)
53+
delay(10000); // Wait 10 seconds before new measurement
54+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
// Bitmap size: 106x45
3+
const uint8_t battSymbol[] = {
4+
0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff,
5+
0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00,
6+
0x00, 0x7f, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x0f, 0xc0, 0x00, 0x00, 0x7f, 0x80, 0x00, 0x7f,
7+
0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x03, 0xc0, 0x00, 0x00, 0xf7, 0xe0, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8,
8+
0x00, 0x01, 0xe0, 0x00, 0x00, 0xe1, 0xf8, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0xe0, 0x00, 0x01,
9+
0xe0, 0x7c, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0xe0, 0x00, 0x01, 0xc0, 0x3f, 0x00, 0xff, 0xff,
10+
0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0xe0, 0x00, 0x03, 0xc0, 0x0f, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00,
11+
0x00, 0xe0, 0x00, 0x03, 0x80, 0x07, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0xe0, 0x00, 0x07, 0x00,
12+
0x07, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0xe0, 0x00, 0x0f, 0x00, 0x0f, 0x80, 0xff, 0xff, 0xff,
13+
0xff, 0xff, 0xf8, 0x00, 0x00, 0xe0, 0x00, 0x0e, 0x00, 0x3e, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00,
14+
0xff, 0x80, 0x0e, 0x00, 0x7c, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0xff, 0xc0, 0x0f, 0x00, 0xf8,
15+
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0xff, 0xc0, 0x07, 0x83, 0xe0, 0x00, 0xff, 0xff, 0xff, 0xff,
16+
0xff, 0xf8, 0x00, 0x00, 0xff, 0xc0, 0x0f, 0x07, 0xc0, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0xff,
17+
0xc0, 0x0e, 0x0f, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0xff, 0xc0, 0x1e, 0x0f, 0x00, 0x00,
18+
0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0xff, 0xc0, 0x3c, 0x0f, 0x80, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff,
19+
0xf8, 0x00, 0x00, 0xff, 0xc0, 0x78, 0x07, 0xc0, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0xff, 0xc0,
20+
0xf0, 0x07, 0xc0, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0xff, 0xc0, 0xe0, 0x0f, 0x80, 0x00, 0xff,
21+
0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0xff, 0xc1, 0xe0, 0x1f, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8,
22+
0x00, 0x00, 0xff, 0xc3, 0xc0, 0x7c, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0xff, 0xc3, 0xe0,
23+
0xf8, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0xff, 0xc1, 0xe1, 0xf0, 0x00, 0x00, 0xff, 0xff,
24+
0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0xff, 0xc0, 0xe3, 0xc0, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00,
25+
0x00, 0xff, 0xc1, 0xe7, 0x80, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0xff, 0xc1, 0xc7, 0x80,
26+
0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0xff, 0xc3, 0xc7, 0xc0, 0x00, 0x00, 0xff, 0xff, 0xff,
27+
0xff, 0xff, 0xf8, 0x00, 0x00, 0xff, 0xc3, 0x83, 0xc0, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00,
28+
0xff, 0x87, 0x07, 0xc0, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0xe0, 0x0f, 0x1f, 0x00, 0x00,
29+
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0xe0, 0x0e, 0x3e, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
30+
0xff, 0xf8, 0x00, 0x00, 0xe0, 0x1e, 0x7c, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0xe0,
31+
0x1c, 0xf0, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0xe0, 0x3b, 0xe0, 0x00, 0x00, 0x00,
32+
0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x01, 0xe0, 0x7f, 0xc0, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff,
33+
0xf8, 0x00, 0x03, 0xe0, 0x7f, 0x80, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x07, 0xc0, 0xfe,
34+
0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x1f, 0xc0, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x3f,
35+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff,
36+
0xff, 0xff, 0x03, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x03, 0xc0, 0x00,
37+
0x00, 0x00, 0x00};
38+
39+
int battSymbol_w = 106;
40+
int battSymbol_h = 45;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
Inkplate_Bluetooth_Peripheral_Mode_Example example for e-radionica Inkplate 6
3+
For this example you will need USB cable and an Inkplate 6
4+
Select "Inkplate 6(ESP32)" from Tools -> Board menu.
5+
Don't have "Inkplate 6(ESP32)" option? Follow our tutorial and add it:
6+
https://e-radionica.com/en/blog/add-inkplate-6-to-arduino-ide/
7+
8+
This example shows how to use Inkplate as a peripheral device over Bluetooth.
9+
Note: for this to work you need to use ESP32 Wroover Board definition, as ours currently has a bug :(
10+
11+
Want to learn more about Inkplate? Visit www.inkplate.io
12+
Looking to get support? Write on our forums: http://forum.e-radionica.com/en/
13+
15 July 2020 by e-radionica.com
14+
*/
15+
16+
#include "Inkplate.h"
17+
18+
#include "BluetoothSerial.h"
19+
20+
#define BUFFER_SIZE 1000
21+
22+
#include "Peripheral.h"
23+
24+
// Declare Inkplate and SerialBluetooth objects
25+
Inkplate display;
26+
BluetoothSerial SerialBT;
27+
28+
// Temporary buffer to send to Peripheral mode code
29+
char commandBuffer[BUFFER_SIZE + 1];
30+
31+
void setup() // Initialize everything
32+
{
33+
Serial.begin(115200);
34+
35+
if (!SerialBT.begin("ESP32"))
36+
{
37+
Serial.println("An error occurred initializing Bluetooth");
38+
}
39+
40+
display.begin();
41+
}
42+
43+
void loop()
44+
{
45+
while (SerialBT.available()) // When Bluetooth available save it and pass to Peripheral.h code
46+
{
47+
for (int i = 0; i < (BUFFER_SIZE - 1); i++)
48+
{
49+
commandBuffer[i] = commandBuffer[i + 1];
50+
}
51+
commandBuffer[BUFFER_SIZE - 1] = SerialBT.read();
52+
Serial.print(commandBuffer[BUFFER_SIZE - 1]);
53+
}
54+
55+
// Function in peripheral.h
56+
run(commandBuffer, BUFFER_SIZE);
57+
58+
delay(50);
59+
}

0 commit comments

Comments
 (0)