Barmaja-PyArduino 2.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- Barmaja_PyArduino/BARMAJA_PyArduino.ico +0 -0
- Barmaja_PyArduino/__init__.py +528 -0
- Barmaja_PyArduino/__init__.pyi +331 -0
- Barmaja_PyArduino/__main__.py +2 -0
- Barmaja_PyArduino/adapters/__init__.py +35 -0
- Barmaja_PyArduino/api_registry.py +459 -0
- Barmaja_PyArduino/backend/__init__.py +3 -0
- Barmaja_PyArduino/backend/uno_cpp.py +1680 -0
- Barmaja_PyArduino/board.py +80 -0
- Barmaja_PyArduino/cli.py +223 -0
- Barmaja_PyArduino/compiler.py +1721 -0
- Barmaja_PyArduino/console.py +217 -0
- Barmaja_PyArduino/device_packs.py +367 -0
- Barmaja_PyArduino/device_packs_builtin/Button/arduino/Barmaja_Button/library.properties +9 -0
- Barmaja_PyArduino/device_packs_builtin/Button/arduino/Barmaja_Button/src/Barmaja_Button.h +18 -0
- Barmaja_PyArduino/device_packs_builtin/Button/example.py +10 -0
- Barmaja_PyArduino/device_packs_builtin/Button/pack.json +40 -0
- Barmaja_PyArduino/device_packs_builtin/ClockDS3231/arduino/Barmaja_ClockDS3231/library.properties +9 -0
- Barmaja_PyArduino/device_packs_builtin/ClockDS3231/arduino/Barmaja_ClockDS3231/src/Barmaja_ClockDS3231.h +20 -0
- Barmaja_PyArduino/device_packs_builtin/ClockDS3231/example.py +8 -0
- Barmaja_PyArduino/device_packs_builtin/ClockDS3231/pack.json +136 -0
- Barmaja_PyArduino/device_packs_builtin/DistanceVL53L0X/arduino/Barmaja_DistanceVL53L0X/library.properties +9 -0
- Barmaja_PyArduino/device_packs_builtin/DistanceVL53L0X/arduino/Barmaja_DistanceVL53L0X/src/Barmaja_DistanceVL53L0X.h +12 -0
- Barmaja_PyArduino/device_packs_builtin/DistanceVL53L0X/example.py +8 -0
- Barmaja_PyArduino/device_packs_builtin/DistanceVL53L0X/pack.json +48 -0
- Barmaja_PyArduino/device_packs_builtin/LCDParallel/arduino/Barmaja_LCDParallel/library.properties +9 -0
- Barmaja_PyArduino/device_packs_builtin/LCDParallel/arduino/Barmaja_LCDParallel/src/Barmaja_LCDParallel.h +17 -0
- Barmaja_PyArduino/device_packs_builtin/LCDParallel/example.py +10 -0
- Barmaja_PyArduino/device_packs_builtin/LCDParallel/pack.json +137 -0
- Barmaja_PyArduino/device_packs_builtin/LoadCellHX711/arduino/Barmaja_LoadCellHX711/library.properties +9 -0
- Barmaja_PyArduino/device_packs_builtin/LoadCellHX711/arduino/Barmaja_LoadCellHX711/src/Barmaja_LoadCellHX711.h +16 -0
- Barmaja_PyArduino/device_packs_builtin/LoadCellHX711/example.py +11 -0
- Barmaja_PyArduino/device_packs_builtin/LoadCellHX711/pack.json +74 -0
- Barmaja_PyArduino/device_packs_builtin/NeoPixelStrip/arduino/Barmaja_NeoPixelStrip/library.properties +9 -0
- Barmaja_PyArduino/device_packs_builtin/NeoPixelStrip/arduino/Barmaja_NeoPixelStrip/src/Barmaja_NeoPixelStrip.h +15 -0
- Barmaja_PyArduino/device_packs_builtin/NeoPixelStrip/example.py +13 -0
- Barmaja_PyArduino/device_packs_builtin/NeoPixelStrip/pack.json +114 -0
- Barmaja_PyArduino/device_packs_builtin/OLEDText/arduino/Barmaja_OLEDText/library.properties +9 -0
- Barmaja_PyArduino/device_packs_builtin/OLEDText/arduino/Barmaja_OLEDText/src/Barmaja_OLEDText.h +21 -0
- Barmaja_PyArduino/device_packs_builtin/OLEDText/example.py +9 -0
- Barmaja_PyArduino/device_packs_builtin/OLEDText/pack.json +103 -0
- Barmaja_PyArduino/device_packs_builtin/PressureBMP280/arduino/Barmaja_PressureBMP280/library.properties +9 -0
- Barmaja_PyArduino/device_packs_builtin/PressureBMP280/arduino/Barmaja_PressureBMP280/src/Barmaja_PressureBMP280.h +16 -0
- Barmaja_PyArduino/device_packs_builtin/PressureBMP280/example.py +8 -0
- Barmaja_PyArduino/device_packs_builtin/PressureBMP280/pack.json +92 -0
- Barmaja_PyArduino/device_packs_builtin/RotaryEncoder/arduino/Barmaja_RotaryEncoder/library.properties +9 -0
- Barmaja_PyArduino/device_packs_builtin/RotaryEncoder/arduino/Barmaja_RotaryEncoder/src/Barmaja_RotaryEncoder.h +18 -0
- Barmaja_PyArduino/device_packs_builtin/RotaryEncoder/example.py +10 -0
- Barmaja_PyArduino/device_packs_builtin/RotaryEncoder/pack.json +44 -0
- Barmaja_PyArduino/device_packs_builtin/ServoDriverPCA9685/arduino/Barmaja_ServoDriverPCA9685/library.properties +9 -0
- Barmaja_PyArduino/device_packs_builtin/ServoDriverPCA9685/arduino/Barmaja_ServoDriverPCA9685/src/Barmaja_ServoDriverPCA9685.h +15 -0
- Barmaja_PyArduino/device_packs_builtin/ServoDriverPCA9685/example.py +10 -0
- Barmaja_PyArduino/device_packs_builtin/ServoDriverPCA9685/pack.json +117 -0
- Barmaja_PyArduino/device_packs_builtin/ShiftRegister595/arduino/Barmaja_ShiftRegister595/library.properties +9 -0
- Barmaja_PyArduino/device_packs_builtin/ShiftRegister595/arduino/Barmaja_ShiftRegister595/src/Barmaja_ShiftRegister595.h +14 -0
- Barmaja_PyArduino/device_packs_builtin/ShiftRegister595/example.py +9 -0
- Barmaja_PyArduino/device_packs_builtin/ShiftRegister595/pack.json +83 -0
- Barmaja_PyArduino/device_packs_builtin/TemperatureDS18B20/arduino/Barmaja_TemperatureDS18B20/library.properties +9 -0
- Barmaja_PyArduino/device_packs_builtin/TemperatureDS18B20/arduino/Barmaja_TemperatureDS18B20/src/Barmaja_TemperatureDS18B20.h +16 -0
- Barmaja_PyArduino/device_packs_builtin/TemperatureDS18B20/example.py +8 -0
- Barmaja_PyArduino/device_packs_builtin/TemperatureDS18B20/pack.json +63 -0
- Barmaja_PyArduino/doctor.py +406 -0
- Barmaja_PyArduino/environment.py +595 -0
- Barmaja_PyArduino/errors.py +166 -0
- Barmaja_PyArduino/flow.py +754 -0
- Barmaja_PyArduino/frontend.py +611 -0
- Barmaja_PyArduino/installer.py +151 -0
- Barmaja_PyArduino/ir.py +660 -0
- Barmaja_PyArduino/library_adder.py +440 -0
- Barmaja_PyArduino/live.py +859 -0
- Barmaja_PyArduino/lowering.py +596 -0
- Barmaja_PyArduino/numeric.py +748 -0
- Barmaja_PyArduino/pack_builder.py +544 -0
- Barmaja_PyArduino/py.typed +0 -0
- Barmaja_PyArduino/serial_monitor.py +172 -0
- Barmaja_PyArduino/source.py +184 -0
- Barmaja_PyArduino/stubgen.py +148 -0
- Barmaja_PyArduino/symbols.py +646 -0
- Barmaja_PyArduino/target.py +1631 -0
- Barmaja_PyArduino/toolchain.py +506 -0
- Barmaja_PyArduino/typesys.py +917 -0
- Barmaja_PyArduino/workflow.py +213 -0
- barmaja_pyarduino-2.0.0.dist-info/METADATA +39 -0
- barmaja_pyarduino-2.0.0.dist-info/RECORD +87 -0
- barmaja_pyarduino-2.0.0.dist-info/WHEEL +5 -0
- barmaja_pyarduino-2.0.0.dist-info/licenses/LICENSE.txt +7 -0
- barmaja_pyarduino-2.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
#include <Arduino.h>
|
|
3
|
+
#include <Wire.h>
|
|
4
|
+
#include <RTClib.h>
|
|
5
|
+
// Each getter reads the clock once (so hour/minute/second are fresh per call).
|
|
6
|
+
class ClockDS3231 {
|
|
7
|
+
public:
|
|
8
|
+
bool begin() { return rtc_.begin(); }
|
|
9
|
+
void setTime(int y, int mo, int d, int h, int mi, int s) { rtc_.adjust(DateTime(y, mo, d, h, mi, s)); }
|
|
10
|
+
int year() { return rtc_.now().year(); }
|
|
11
|
+
int month() { return rtc_.now().month(); }
|
|
12
|
+
int day() { return rtc_.now().day(); }
|
|
13
|
+
int hour() { return rtc_.now().hour(); }
|
|
14
|
+
int minute() { return rtc_.now().minute(); }
|
|
15
|
+
int second() { return rtc_.now().second(); }
|
|
16
|
+
float temperature() { return rtc_.getTemperature(); }
|
|
17
|
+
bool lostPower() { return rtc_.lostPower(); }
|
|
18
|
+
private:
|
|
19
|
+
RTC_DS3231 rtc_;
|
|
20
|
+
};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema": 1,
|
|
3
|
+
"class": "ClockDS3231",
|
|
4
|
+
"title": "DS3231 real-time clock module (I2C)",
|
|
5
|
+
"status": "compile-verified",
|
|
6
|
+
"boards": [
|
|
7
|
+
"uno",
|
|
8
|
+
"nano"
|
|
9
|
+
],
|
|
10
|
+
"constructor": [],
|
|
11
|
+
"methods": {
|
|
12
|
+
"begin": {
|
|
13
|
+
"params": [],
|
|
14
|
+
"returns": "Bool",
|
|
15
|
+
"starts": true
|
|
16
|
+
},
|
|
17
|
+
"setTime": {
|
|
18
|
+
"params": [
|
|
19
|
+
{
|
|
20
|
+
"name": "year",
|
|
21
|
+
"type": "Int",
|
|
22
|
+
"range": [
|
|
23
|
+
2000,
|
|
24
|
+
2099
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"name": "month",
|
|
29
|
+
"type": "Int",
|
|
30
|
+
"range": [
|
|
31
|
+
1,
|
|
32
|
+
12
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "day",
|
|
37
|
+
"type": "Int",
|
|
38
|
+
"range": [
|
|
39
|
+
1,
|
|
40
|
+
31
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "hour",
|
|
45
|
+
"type": "Int",
|
|
46
|
+
"range": [
|
|
47
|
+
0,
|
|
48
|
+
23
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"name": "minute",
|
|
53
|
+
"type": "Int",
|
|
54
|
+
"range": [
|
|
55
|
+
0,
|
|
56
|
+
59
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"name": "second",
|
|
61
|
+
"type": "Int",
|
|
62
|
+
"range": [
|
|
63
|
+
0,
|
|
64
|
+
59
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
"returns": "Void"
|
|
69
|
+
},
|
|
70
|
+
"year": {
|
|
71
|
+
"params": [],
|
|
72
|
+
"returns": "Int"
|
|
73
|
+
},
|
|
74
|
+
"month": {
|
|
75
|
+
"params": [],
|
|
76
|
+
"returns": "Int"
|
|
77
|
+
},
|
|
78
|
+
"day": {
|
|
79
|
+
"params": [],
|
|
80
|
+
"returns": "Int"
|
|
81
|
+
},
|
|
82
|
+
"hour": {
|
|
83
|
+
"params": [],
|
|
84
|
+
"returns": "Int"
|
|
85
|
+
},
|
|
86
|
+
"minute": {
|
|
87
|
+
"params": [],
|
|
88
|
+
"returns": "Int"
|
|
89
|
+
},
|
|
90
|
+
"second": {
|
|
91
|
+
"params": [],
|
|
92
|
+
"returns": "Int"
|
|
93
|
+
},
|
|
94
|
+
"temperature": {
|
|
95
|
+
"params": [],
|
|
96
|
+
"returns": "Float"
|
|
97
|
+
},
|
|
98
|
+
"lostPower": {
|
|
99
|
+
"params": [],
|
|
100
|
+
"returns": "Bool"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"resources": [
|
|
104
|
+
"i2c"
|
|
105
|
+
],
|
|
106
|
+
"warnings": [],
|
|
107
|
+
"adapter": {
|
|
108
|
+
"library": "Barmaja_ClockDS3231",
|
|
109
|
+
"header": "Barmaja_ClockDS3231.h"
|
|
110
|
+
},
|
|
111
|
+
"dependencies": [
|
|
112
|
+
{
|
|
113
|
+
"id": "adafruit-busio",
|
|
114
|
+
"name": "Adafruit BusIO",
|
|
115
|
+
"version": "1.17.4",
|
|
116
|
+
"header": "Adafruit_I2CDevice.h",
|
|
117
|
+
"license": "MIT",
|
|
118
|
+
"source": "https://github.com/adafruit/Adafruit_BusIO",
|
|
119
|
+
"tag": "1.17.4",
|
|
120
|
+
"library_folder": "Adafruit_BusIO"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"id": "adafruit-rtclib",
|
|
124
|
+
"name": "RTClib",
|
|
125
|
+
"version": "2.1.4",
|
|
126
|
+
"header": "RTClib.h",
|
|
127
|
+
"license": "MIT",
|
|
128
|
+
"source": "https://github.com/adafruit/RTClib",
|
|
129
|
+
"tag": "2.1.4",
|
|
130
|
+
"library_folder": "RTClib"
|
|
131
|
+
}
|
|
132
|
+
],
|
|
133
|
+
"liverun": false,
|
|
134
|
+
"example": "from Barmaja_PyArduino import *\nupload()\n\nclock = ClockDS3231()\nclock.begin()\nwhile True:\n print(f\"{clock.hour()}:{clock.minute()}:{clock.second()}\")\n delay(1000)\n",
|
|
135
|
+
"notes": "Use setTime() once, then remove it so every reset does not set the old time again."
|
|
136
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
#include <Arduino.h>
|
|
3
|
+
#include <Wire.h>
|
|
4
|
+
#include <VL53L0X.h>
|
|
5
|
+
class DistanceVL53L0X {
|
|
6
|
+
public:
|
|
7
|
+
bool begin() { Wire.begin(); sensor_.setTimeout(500); if (!sensor_.init()) return false; sensor_.startContinuous(); return true; }
|
|
8
|
+
int readMillimeters() { return (int)sensor_.readRangeContinuousMillimeters(); }
|
|
9
|
+
bool timedOut() { return sensor_.timeoutOccurred(); }
|
|
10
|
+
private:
|
|
11
|
+
VL53L0X sensor_;
|
|
12
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema": 1,
|
|
3
|
+
"class": "DistanceVL53L0X",
|
|
4
|
+
"title": "VL53L0X laser time-of-flight distance sensor (I2C, up to ~1.2 m)",
|
|
5
|
+
"status": "compile-verified",
|
|
6
|
+
"boards": [
|
|
7
|
+
"uno",
|
|
8
|
+
"nano"
|
|
9
|
+
],
|
|
10
|
+
"constructor": [],
|
|
11
|
+
"methods": {
|
|
12
|
+
"begin": {
|
|
13
|
+
"params": [],
|
|
14
|
+
"returns": "Bool",
|
|
15
|
+
"starts": true
|
|
16
|
+
},
|
|
17
|
+
"readMillimeters": {
|
|
18
|
+
"params": [],
|
|
19
|
+
"returns": "Int"
|
|
20
|
+
},
|
|
21
|
+
"timedOut": {
|
|
22
|
+
"params": [],
|
|
23
|
+
"returns": "Bool"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"resources": [
|
|
27
|
+
"i2c"
|
|
28
|
+
],
|
|
29
|
+
"warnings": [],
|
|
30
|
+
"adapter": {
|
|
31
|
+
"library": "Barmaja_DistanceVL53L0X",
|
|
32
|
+
"header": "Barmaja_DistanceVL53L0X.h"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": [
|
|
35
|
+
{
|
|
36
|
+
"id": "pololu-vl53l0x",
|
|
37
|
+
"name": "VL53L0X",
|
|
38
|
+
"version": "1.3.1",
|
|
39
|
+
"header": "VL53L0X.h",
|
|
40
|
+
"license": "MIT (Pololu; includes ST API notice)",
|
|
41
|
+
"source": "https://github.com/pololu/vl53l0x-arduino",
|
|
42
|
+
"tag": "1.3.1",
|
|
43
|
+
"library_folder": "VL53L0X"
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"liverun": false,
|
|
47
|
+
"example": "from Barmaja_PyArduino import *\nupload()\n\nlaser = DistanceVL53L0X()\nlaser.begin()\nwhile True:\n print(\"Distance =\", laser.readMillimeters(), \"mm\")\n delay(200)\n"
|
|
48
|
+
}
|
Barmaja_PyArduino/device_packs_builtin/LCDParallel/arduino/Barmaja_LCDParallel/library.properties
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
name=Barmaja_LCDParallel
|
|
2
|
+
version=1.1.0
|
|
3
|
+
author=BARMAJA
|
|
4
|
+
maintainer=BARMAJA
|
|
5
|
+
sentence=BARMAJA PyArduino device-pack adapter: 16x2 / 20x4 character LCD wired in 4-bit parallel mode (no I2C backpack)
|
|
6
|
+
paragraph=
|
|
7
|
+
category=Device Control
|
|
8
|
+
url=
|
|
9
|
+
architectures=avr
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
#include <Arduino.h>
|
|
3
|
+
#include <LiquidCrystal.h>
|
|
4
|
+
// Inherits Print, so print()/println() and f-strings work like Serial.
|
|
5
|
+
class LCDParallel : public Print {
|
|
6
|
+
public:
|
|
7
|
+
LCDParallel(uint8_t rs, uint8_t en, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7): lcd_(rs, en, d4, d5, d6, d7) {}
|
|
8
|
+
void begin(int columns = 16, int rows = 2) { lcd_.begin((uint8_t)columns, (uint8_t)rows); }
|
|
9
|
+
void clear() { lcd_.clear(); }
|
|
10
|
+
void home() { lcd_.home(); }
|
|
11
|
+
void setCursor(int column, int row) { lcd_.setCursor((uint8_t)column, (uint8_t)row); }
|
|
12
|
+
size_t write(uint8_t c) override { return lcd_.write(c); }
|
|
13
|
+
using Print::print;
|
|
14
|
+
using Print::println;
|
|
15
|
+
private:
|
|
16
|
+
LiquidCrystal lcd_;
|
|
17
|
+
};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema": 1,
|
|
3
|
+
"class": "LCDParallel",
|
|
4
|
+
"title": "16x2 / 20x4 character LCD wired in 4-bit parallel mode (no I2C backpack)",
|
|
5
|
+
"status": "compile-verified",
|
|
6
|
+
"boards": [
|
|
7
|
+
"uno",
|
|
8
|
+
"nano"
|
|
9
|
+
],
|
|
10
|
+
"constructor": [
|
|
11
|
+
{
|
|
12
|
+
"name": "rs",
|
|
13
|
+
"type": "Int",
|
|
14
|
+
"rule": "digital_pin"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "en",
|
|
18
|
+
"type": "Int",
|
|
19
|
+
"rule": "digital_pin"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "d4",
|
|
23
|
+
"type": "Int",
|
|
24
|
+
"rule": "digital_pin"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "d5",
|
|
28
|
+
"type": "Int",
|
|
29
|
+
"rule": "digital_pin"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "d6",
|
|
33
|
+
"type": "Int",
|
|
34
|
+
"rule": "digital_pin"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "d7",
|
|
38
|
+
"type": "Int",
|
|
39
|
+
"rule": "digital_pin"
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"methods": {
|
|
43
|
+
"begin": {
|
|
44
|
+
"params": [
|
|
45
|
+
{
|
|
46
|
+
"name": "columns",
|
|
47
|
+
"type": "Int",
|
|
48
|
+
"range": [
|
|
49
|
+
8,
|
|
50
|
+
40
|
|
51
|
+
],
|
|
52
|
+
"default": 16
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "rows",
|
|
56
|
+
"type": "Int",
|
|
57
|
+
"range": [
|
|
58
|
+
1,
|
|
59
|
+
4
|
|
60
|
+
],
|
|
61
|
+
"default": 2
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"returns": "Void",
|
|
65
|
+
"starts": true
|
|
66
|
+
},
|
|
67
|
+
"clear": {
|
|
68
|
+
"params": [],
|
|
69
|
+
"returns": "Void"
|
|
70
|
+
},
|
|
71
|
+
"home": {
|
|
72
|
+
"params": [],
|
|
73
|
+
"returns": "Void"
|
|
74
|
+
},
|
|
75
|
+
"setCursor": {
|
|
76
|
+
"params": [
|
|
77
|
+
{
|
|
78
|
+
"name": "column",
|
|
79
|
+
"type": "Int",
|
|
80
|
+
"range": [
|
|
81
|
+
0,
|
|
82
|
+
39
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"name": "row",
|
|
87
|
+
"type": "Int",
|
|
88
|
+
"range": [
|
|
89
|
+
0,
|
|
90
|
+
3
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
],
|
|
94
|
+
"returns": "Void"
|
|
95
|
+
},
|
|
96
|
+
"print": {
|
|
97
|
+
"params": [
|
|
98
|
+
{
|
|
99
|
+
"name": "value",
|
|
100
|
+
"type": "Scalar"
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
"returns": "Void"
|
|
104
|
+
},
|
|
105
|
+
"println": {
|
|
106
|
+
"params": [
|
|
107
|
+
{
|
|
108
|
+
"name": "value",
|
|
109
|
+
"type": "Scalar",
|
|
110
|
+
"default": 0
|
|
111
|
+
}
|
|
112
|
+
],
|
|
113
|
+
"returns": "Void"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"resources": [],
|
|
117
|
+
"warnings": [],
|
|
118
|
+
"adapter": {
|
|
119
|
+
"library": "Barmaja_LCDParallel",
|
|
120
|
+
"header": "Barmaja_LCDParallel.h"
|
|
121
|
+
},
|
|
122
|
+
"dependencies": [
|
|
123
|
+
{
|
|
124
|
+
"id": "arduino-liquidcrystal",
|
|
125
|
+
"name": "LiquidCrystal",
|
|
126
|
+
"version": "1.0.7",
|
|
127
|
+
"header": "LiquidCrystal.h",
|
|
128
|
+
"license": "LGPL-2.1 (Arduino)",
|
|
129
|
+
"source": "https://github.com/arduino-libraries/LiquidCrystal",
|
|
130
|
+
"tag": "1.0.7",
|
|
131
|
+
"library_folder": "LiquidCrystal"
|
|
132
|
+
}
|
|
133
|
+
],
|
|
134
|
+
"liverun": false,
|
|
135
|
+
"example": "from Barmaja_PyArduino import *\nupload()\n\nlcd = LCDParallel(12, 11, 5, 4, 3, 2)\nlcd.begin(16, 2)\nlcd.print(\"Hello BARMAJA\")\nwhile True:\n lcd.setCursor(0, 1)\n lcd.print(f\"Light: {analogRead(A0)} \")\n delay(300)\n",
|
|
136
|
+
"notes": "Contrast pin V0 needs a 10k potentiometer."
|
|
137
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
#include <Arduino.h>
|
|
3
|
+
#include <HX711.h>
|
|
4
|
+
// Channel A, gain 128. readUnits() = average of 5 readings / scale factor.
|
|
5
|
+
class LoadCellHX711 {
|
|
6
|
+
public:
|
|
7
|
+
LoadCellHX711(uint8_t dout, uint8_t sck): dout_(dout), sck_(sck) {}
|
|
8
|
+
void begin() { scale_.begin(dout_, sck_); }
|
|
9
|
+
void tare() { scale_.tare(); }
|
|
10
|
+
void setScale(float factor) { scale_.set_scale(factor); }
|
|
11
|
+
float readUnits() { return scale_.get_units(5); }
|
|
12
|
+
bool isReady() { return scale_.is_ready(); }
|
|
13
|
+
private:
|
|
14
|
+
uint8_t dout_, sck_;
|
|
15
|
+
HX711 scale_;
|
|
16
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema": 1,
|
|
3
|
+
"class": "LoadCellHX711",
|
|
4
|
+
"title": "HX711 load-cell amplifier (kitchen-scale sensor)",
|
|
5
|
+
"status": "compile-verified",
|
|
6
|
+
"boards": [
|
|
7
|
+
"uno",
|
|
8
|
+
"nano"
|
|
9
|
+
],
|
|
10
|
+
"constructor": [
|
|
11
|
+
{
|
|
12
|
+
"name": "dout_pin",
|
|
13
|
+
"type": "Int",
|
|
14
|
+
"rule": "digital_pin"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "sck_pin",
|
|
18
|
+
"type": "Int",
|
|
19
|
+
"rule": "digital_pin"
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"methods": {
|
|
23
|
+
"begin": {
|
|
24
|
+
"params": [],
|
|
25
|
+
"returns": "Void",
|
|
26
|
+
"starts": true
|
|
27
|
+
},
|
|
28
|
+
"tare": {
|
|
29
|
+
"params": [],
|
|
30
|
+
"returns": "Void"
|
|
31
|
+
},
|
|
32
|
+
"setScale": {
|
|
33
|
+
"params": [
|
|
34
|
+
{
|
|
35
|
+
"name": "factor",
|
|
36
|
+
"type": [
|
|
37
|
+
"Float",
|
|
38
|
+
"Int"
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"returns": "Void"
|
|
43
|
+
},
|
|
44
|
+
"readUnits": {
|
|
45
|
+
"params": [],
|
|
46
|
+
"returns": "Float"
|
|
47
|
+
},
|
|
48
|
+
"isReady": {
|
|
49
|
+
"params": [],
|
|
50
|
+
"returns": "Bool"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"resources": [],
|
|
54
|
+
"warnings": [],
|
|
55
|
+
"adapter": {
|
|
56
|
+
"library": "Barmaja_LoadCellHX711",
|
|
57
|
+
"header": "Barmaja_LoadCellHX711.h"
|
|
58
|
+
},
|
|
59
|
+
"dependencies": [
|
|
60
|
+
{
|
|
61
|
+
"id": "bogde-hx711",
|
|
62
|
+
"name": "HX711",
|
|
63
|
+
"version": "0.7.5",
|
|
64
|
+
"header": "HX711.h",
|
|
65
|
+
"license": "MIT",
|
|
66
|
+
"source": "https://github.com/bogde/HX711",
|
|
67
|
+
"tag": "0.7.5",
|
|
68
|
+
"library_folder": "HX711"
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
"liverun": false,
|
|
72
|
+
"example": "from Barmaja_PyArduino import *\nupload()\n\nscale = LoadCellHX711(3, 2)\nscale.begin()\nscale.setScale(420.0)\nscale.tare()\nwhile True:\n if scale.isReady():\n print(\"Weight =\", scale.readUnits(), \"g\")\n delay(500)\n",
|
|
73
|
+
"notes": "Calibrate setScale() with a known weight."
|
|
74
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
#include <Arduino.h>
|
|
3
|
+
#include <Adafruit_NeoPixel.h>
|
|
4
|
+
// GRB 800 kHz strips/rings (WS2812B). Call show() to send the colors.
|
|
5
|
+
class NeoPixelStrip {
|
|
6
|
+
public:
|
|
7
|
+
NeoPixelStrip(uint8_t pin, uint16_t count): strip_(count, pin, NEO_GRB + NEO_KHZ800) {}
|
|
8
|
+
void begin() { strip_.begin(); strip_.show(); }
|
|
9
|
+
void setPixel(int index, int r, int g, int b) { strip_.setPixelColor((uint16_t)index, (uint8_t)r, (uint8_t)g, (uint8_t)b); }
|
|
10
|
+
void setBrightness(int level) { strip_.setBrightness((uint8_t)level); }
|
|
11
|
+
void clear() { strip_.clear(); }
|
|
12
|
+
void show() { strip_.show(); }
|
|
13
|
+
private:
|
|
14
|
+
Adafruit_NeoPixel strip_;
|
|
15
|
+
};
|