Turinys:
- Prekės:
- 1 žingsnis: schema
- 2 veiksmas: kodas Arduino
- 3 žingsnis: realizavimas
- 4 veiksmas: kodo įkrovimas ir bandymas bei įdėjimas į dėžutę
- 5 veiksmas:
Mažas LED testerio projektas
Aš ieškojau už LED testerio NET ir po to, kai pamatiau idėją, norėjau statyti šį testerį nuo nulio
Prekės:
1 žingsnis: schema
Norint išbandyti LED, jums reikia srovės generatoriaus.
LM317LZ duomenų lape pateikiamas žemėlapis, žr. Pagrindinės idėjos svetainę
www.robotroom.com/LED-Tester-Pro-1.html
šiame tinklalapyje nėra kodo
todėl principas yra matuoti keletą įtampų LED lizduose
VH anodo įtampos VL katodo įtampa ir atimama iš jų (VH - VL)
tada išmatuoti įtampą, esančią varžto gale, einančioje šviesos diodo IL srovėje, ir padalijus iš jos vertės R (VR / R = IL)
2 veiksmas: kodas Arduino
Arduino kodui buvo nustatyta pagrindinė idėja, kurią norėjau rodyti ekrane OLED
biblioteka skirta ssd1306
github.com/adafruit/Adafruit_SSD1306
Skirtingų įtampų matavimui žr
http: //www.instructables.com/id/Arduino-OLED-Volt …
Dėl skirtingų meniu pasirinkimų žr
it-edukacija.eu.hr/multidruino/default.html
Norėdami sukurti piktogramas, žr
javl.github.io/image2cpp/
mes išbandome bandymų lentą
kodas čia:
// ================================================
// Autorius: PHILOUPAT
// Mars 2019 // 1 versija: vienas mygtukas, rodymo režimai OLED I2C, AREF numatytasis // ==================================== ===================
// I2C OLED DISPLAY: SCL = A5, SDA = A4
// A0 įvesties nuoroda apskaičiavimui RL
// A1 įvestis Vbat
// A2 įėjimas VL
// A7 įėjimas VH
// ================================================
#include
#include
#include
#include
#include
#include
#define SSD1306_128_64
#define SCREEN_WIDTH 128
// OLED ekrano plotis pikseliais
#define SCREEN_HEIGHT 64
// OLED ekrano aukštis pikseliais
// SSD1306 ekrano prijungimas prie I2C (SDA, SCL smeigtukai)
#define OLED_RESET -1 // Atstatyti pin # (arba -1, jei bendrinate „Arduino“ iš naujo)
„Adafruit_SSD1306“ ekranas (SCREEN_WIDTH, SCREEN_HEIGHT, & Wire, OLED_RESET);
#define XPOS 0
#define YPOS 1
#define DELTAY 2
// # jei (SSD1306_LCDHEIGHT! = 64)
// # klaida ("Aukštis neteisingas, prašome pataisyti Adafruit_SSD1306.h!");
// # endif
const unsigned char PROGMEM batterie = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xfe, 0x00, 0x20, 0x00, 0x00, 0x20, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x00, 0x03, 0xe0, 0x20, 0x00, 0x00, 0x02, 0x20, 0x00, 0x02, 0x20, 0x24, 0x00, 0x00, 0x82, 0x00, 0x00, 0x82, 0x20, 0x24, 0x00, 0x01, 0xe2, 0x20, 0x24, 0x00, 0x00, 0x82, 0x20, 0x20, 0x00, 0x00, 0x82, 0x20, 0x20, 0x00, 0x20, 0x20, 0x00, 0x00, 0x03, 0xe0, 0x20, 0x00, 0x00, 0x20, 0x00, 0x00, 0x03, 0x00), 0x20, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x00, 0x02, 0x00, 0x3f, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
const unsigned char PROGMEM resis = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x7f, 0x80, 0x00, 0x3f, 0xf8, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x03, 0x80, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x07, 0xfe, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, 0x78, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x01, 0xe0, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x3f, 0xf0, 0x00, 0x01, 0xf0, 0x00, 0x01, 0xf8, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x0f, 0xf8, 0x00, 0x03, 0xff, 0x00, 0x00, 0x03, 0x0, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x38, 0x00, 0x00 0x00, 0x0c, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff ff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff t 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff t 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff t 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff t 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff t 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff t 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
const unsigned char oms PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x0c, 0x30, 0x18, 0x18, 0x18, 0x0c, 0x30, 0x0c, 0x30, 0x0c, 0x30, 0x0c, 0x30, 0x0c, 0x18, 0x0c, 0x0c, 0x18, 0x0c, 0x08, 0x18, 0x0c, 0x08, 0x18, 0x0c, 0x30, 0x18, 0x0c, 0x30, 0x06, 0x0c, 0x30, 0x06, 0x0c, 0x30, 0x18, 0x0c, 0x30, 0x06, 0x0c, 0x30, 0x18, 0x0c, 0x30, 0x06, 0x30, 0x1e, 0x3c, 0x1c, 0x3c, 0x00, 0x00, 0x00, 0x00};
const unsigned char PROGMEM led = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0x3f, 0xf8, 0x00, 0x00, 0xf, 0x00, 0x00, 0xff, 0xfc, 0x00, 0x00, 0xff, 0xfe, 0x00, 0x01, 0xff, 0xff, 0x00, 0x03, 0xff, 0xff, 0x00, 0x03, 0xff, 0xff, 0x80, 0x03, 0xff, 0xff, 0x80, 0xff, 0xff, 0x80, 0x07, 0xff, 0xff, 0xc0, 0x07, 0xff, 0xc0, 0x07, 0xff, 0xff, 0xc0, 0x07, 0xff, 0xff, 0xc0, 0x07, 0xff, 0xff, 0xc0, 0x07, 0xff, 0xff, 0xc0, 0x07, 0xff, 0xff, 0xc0, 0x07, 0xff, 0xc0, 0x07, 0xff, 0xff, 0xc0, 0x07, 0xff, 0xc0, 0x07, 0xff, 0xf0 0xc0, 0x07, 0xff, 0xff, 0xc0, 0x07, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xf7, 0xff, 0xf0, 0xf, 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xf, 0x1f, 0xff, 0xff, 0xf8, 0x0f, 0xcf, 0xfe, 0x0f, 0xcf, 0xfe, 0xf0, 0x00 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0e, 0x00, 0x01, 0xe0, 0xe, 0x00, 0x00, 0xe0, 0x0e, 0x00, 0x01, 0x0e, 0x00, 0x01, 0xe0, 0x0e, 0x00, 0x01, 0xe0, 0x00, 0x01, 0xe0, 0x0e, 0x00, 0x00, 0xe0, 0x0e, 0x00, 0x01, 0xe0, 0x0e, 0x00, 0x01, 0xe0, 0x0e, 0x00, 0x01, 0xe0, 0x0e, 0xe0, 0x0e 0x00;, 0x00, 0xc0, 0x0c, 0x00, 0x00, 0xc0, 0xc, 0x00, 0x00, 0xc0, 0x0c, 0x00, 0x00, 0x0, 0x04, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
const unsigned char accueil PROGMEM = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff t 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff t 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x03, 0xff, 0xc0, 0x03 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xe1, 0xd8, 0xc3, 0xf, 0xd8, 0xc3, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xc1, 0xd9, 0x83, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 0xff, 0xe6, 0xff, 0xf9, 0x83, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc4, 0xe1, 0xb9, 0x83, 0xff, 0xff, 0x83, 0xff, 0xff, 0xf8, 0xff, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc4, 0xf9, 0xb1, 0xa3, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x83, 0xf3, 0x07, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe1, 0x83, 0x73, 0x0f, 0xff, 0x73, 0x0f, 0xff, 0xff, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x3 0xff, 0xf3, 0xf8, 0x02, 0x03, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x3f, 0xff, 0xe3, 0xf8, 0x06, 0x01, 0xff, 0x06, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x3f, 0xff, 0xe3, 0xf1, 0xfc, 0x30, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x ff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x3f, 0xff, 0xe3, 0xf1, 0xfc, 0x78, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7 0xf3, 0xbc, 0x7c, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc7, 0xe0, 0x1c, 0x7c, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 0xff, 0xf0, 0x04, 0x00, 0x0f, 0xff, 0xc7, 0xe0, 0x3c, 0x7c, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x07, 0xff, 0xcf, 0x07, 0xff, 0xcf, 0xe1, 0xfc, 0xe1, 0xfc 0x7c, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x07, 0xff, 0x8f, 0xe3, 0xf8, 0x7c, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 0x00; 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x07, 0xff, 0x88, 0x07, 0x88, 0x60, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xf0, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x07, 0xff, 0x80, 0x00, 0x08, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf1, 0xf9, 0xff, 0xf1, 0xf9, 0xff, 0xcf, 0xff, 0x80, 0x00, 0x08, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 0xff, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xf 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 0xff, 0xff, 0x1f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xf0, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xf0, 0xff, 0xff, 0xe0, 0x1c, 0x01, 0xc0, 0xe0, 0x1c, 0x01, 0x0f, 0x18, 0x07, 0xf, 0x18, 0x07, 0xff, 0xff, 0x07 0x1f, 0xf0, 0xff, 0xff, 0x80, 0x04, 0x03, 0x00, 0x00, 0x04, 0x01, 0x1f, 0x98, 0x03, 0xf, 0xff, 0x1f, 0xf0, 0xff, 0xf, 0xf0, 0xff, 0xff, 0x88, 0x88, 0xfe, 0x88, 0x88, 0xfe, 0x1e, 0x00, 0x40, 0xff, 0x1f, 0x90, 0xe1, 0xff, 0xff, 0x1f, 0xf0, 0xff, 0xff, 0x38, 0xf8, 0xfe, 0x3f, 0xf8, 0x3f, 0xb8, 0xf8;;;, 0xf1, 0xff, 0xfc, 0x71, 0xf1, 0xfe, 0x3f, 0x20, 0x0f, 0xff, 0xff, 0x9f, 0xf9, 0xff, 0xff, 0xe1, 0xe3, 0xfd, 0xfc, 0x71, 0xf1, 0xfe, 0x71, 0xf1, 0xfe, 0x3f, 0x23, 0xfe, 0x3f, 0x23, 0x8f;, 0x00, 0x61, 0xe1, 0xc6, 0x00, 0x63, 0xc7, 0xff, 0xff, 0x9f, 0xf9, 0xff, 0xf, 0xe1, 0xe0, 0x04, 0x00, 0xe1, 0xe0, 0x07, 0x00, 0xe3, 0x07, 0x00, 0xe3, 0xc3, 0xff, 0xff 0x9f, 0xf9, 0xff, 0xff, 0xe1, 0xe0, 0x07, 0x03, 0xe1, 0xe0, 0x07, 0x01, 0xc3, 0xc3, 0xff, 0xff, 0xf, 0xff, 0xff, 0x 9f, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff t 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff t 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff t 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff t 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
int režimas = 0;
int pause = 500;
int RL = 0;
int R1 = 10000;
int R2 = 10000;
int R3 = 47;
plūdės neapdorotas = 0;
float val = 0;
float ref = 0;
float vbat = 0;
float vin = 0,00;
float voutL = 0.00;
float voutH = 0.00;
float vref = 0,00;
float vled = 0,00;
plūdės vr = 0,00;
plūdė IL = 0,00;
float vinref = 0,00;
float vinbat = 0;
negaliojantis nustatymas ()
{
pinMode (5, INPUT_PULLUP);
pinMode (4, INPUT_PULLUP);
pinMode (3, INPUT_PULLUP);
attachInterrupt (1, bouton, FALLING);
// pagal nutylėjimą, mes generuosime aukštą įtampą iš 3.3v linijos viduje! (tvarkingas!) display.begin (SSD1306_SWITCHCAPVCC, 0x3C); // inicijuoti I2C priedą 0x3C (128x32)
}
tuščia kilpa ()
{
float vref = readVcc () / 1000.0;
val = analoginisRead (A7);
raw = analogRead (A2);
voutH = (val * vref) / 1024,0; // žr. tekstą
voutL = (neapdorotas * vref) / 1024.0;
jei (voutL> 0)
{
jei (režimas == 0) // caracteristique vadovauja
{
float vref = (readVcc () / 1000.0);
val = analoginisRead (A7);
raw = analogRead (A2);
ref = analoginis (A0);
voutH = (val * vref) / 1024,0; // žr. tekstą
voutL = (neapdorotas * vref) / 1024.0;
vled = (voutH-voutL) * (R1 + R2) / R2;
vr = voutL;
IL = vr / R3;
display.clearDisplay ();
display.setTextColor (WHITE);
display.drawBitmap (96, 0, vadovaujama, 32, 64, 1);
display.setFont ();
display.setFont (& FreeSans9pt7b);
display.setCursor (0,12);
display.print („LED funkcija“);
display.setCursor (0,35);
display.print („VL:“);
display.setCursor (28,35);
display.print (vled);
display.setCursor (72,35);
display.print ("V");
display.setCursor (0,60);
display.print ("IL:");
display.setCursor (28,60);
display.print (IL * 1000);
display.setCursor (75,60);
display.print ("mA");
display.display ();
vėlavimas (pauzė);
}
jei (režimas == 1)
{// atsparumas
float vref = (readVcc () / 1000.0);
val = analoginisRead (A7);
raw = analogRead (A2);
ref = analoginis (A0);
voutH = (val * vref) / 1024.0;
voutL = (neapdorotas * vref) / 1024.0;
vinref = (ref * vref * 2) / 1024.0;
vled = (voutH-voutL) * (R1 + R2) / R2;
IL = voutL / R3;
RL = (vinref-vled) / IL;
display.clearDisplay ();
display.drawBitmap (96, 0, resis, 32, 64, 1);
display.setFont ();
display.setFont (& FreeSans9pt7b);
display.setCursor (0,12);
display.print („Atsparumas:“);
display.setCursor (0,35);
display.print („Vin:“);
display.setCursor (32,35);
display.print (vinref);
display.setCursor (75,35);
display.print ("V");
display.setCursor (0,60);
display.print („RL:“);
jei (RL <0)
{
display.setCursor (30,60);
display.print („tuščias“);
}
Kitas
{
display.setCursor (30,60);
display.print (RL);
display.drawBitmap (73, 46, oms, 15, 15, 1);
}
display.display ();
vėlavimas (pauzė);
}
jei (režimas == 2)
{// baterie
float vref = (readVcc () / 1000.0);
vbat = analoginis (A1);
vinbat = (vbat * vref * 2.3) / 1024.0;
isplay.clearDisplay ();
display.drawBitmap (90, -2, batterie, 36, 21, 1);
display.setFont ();
display.setFont (& FreeSans9pt7b);
display.setCursor (0,14);
display.print („Batterie:“);
//display.fillRect(10,35,90,20,WHITE);
//display.fillRect(12,37,88,18,BLACK);
display.drawRoundRect (15, 40, 95, 24, 8, WHITE);
display.setCursor (0,35);
display.print („Vbat:“);
display.setCursor (50,35);
display.print (vinbat);
display.setCursor (90,35);
display.print ("V");
jei (vinbat> 0 && vinbat <7.0)
{// vienas baras
display.fillRect (20,45,10,15, BLACK);
}
dar jei (vinbat> 7.0 &&bbb <7,8)
{// du barai
display.fillRect (20,45,10,15, BLACK);
display.fillRect (30,45,5,15, WHITE);
display.fillRect (35,45,10,15, BLACK);
}
dar jei (vinbat> 7.8 &&bbb <8,4)
{// trys barai
display.fillRect (20,45,10,15, BLACK);
display.fillRect (30,45,5,15, WHITE);
display.fillRect (35,45,10,15, BLACK);
display.fillRect (45,45,5,15, WHITE);
display.fillRect (50,45,10,15, BLACK);
}
dar jei (vinbat> 8.4 &&bbb <8,7)
{// keturi barai
display.fillRect (20,45,10,15, BLACK);
display.fillRect (30,45,5,15, WHITE);
display.fillRect (35,45,10,15, BLACK);
display.fillRect (45,45,5,15, WHITE);
display.fillRect (50,45,10,15, BLACK);
display.fillRect (60,45,5,15, WHITE);
display.fillRect (65,45,10,15, BLACK);
}
dar jei (vinbat> 8.7 &&bbb <9.0)
{// penki barai
display.fillRect (20,45,10,15, BLACK);
display.fillRect (30,45,5,15, WHITE);
display.fillRect (35,45,10,15, BLACK);
display.fillRect (45,45,5,15, WHITE);
display.fillRect (50,45,10,15, BLACK);
display.fillRect (60,45,5,15, WHITE);
display.fillRect (65,45,10,15, BLACK);
display.fillRect (75,45,5,15, WHITE);
display.fillRect (80,45,10,15, BLACK);
}
dar jei (vinbat> 9.0 &&bbb <9.4)
{
display.fillRect (20,45,10,15, BLACK);
display.fillRect (30,45,5,15, WHITE);
display.fillRect (35,45,10,15, BLACK);
display.fillRect (45,45,5,15, WHITE);
display.fillRect (50,45,10,15, BLACK);
display.fillRect (60,45,5,15, WHITE);
display.fillRect (65,45,10,15, BLACK);
display.fillRect (75,45,5,15, WHITE);
display.fillRect (80,45,10,15, BLACK);
display.fillRect (90,45,5,15, WHITE);
display.fillRect (95,45,10,15, BLACK);
}
display.display (); vėlavimas (pauzė); }
}Kitas
{
display.clearDisplay ();
display.drawBitmap (0, 0, accueil, 128, 64, 1);
display.display ();
vėlavimas (700);
display.display ();
vėlavimas (1000);
}
}
negaliojantis bouton ()
{
statinis nepasirašytas ilgas last_interrupt_time = 0;
nepasirašytas ilgas pertraukimo laikas = milis ();
// Jei pertraukos ateina greičiau nei 200 ms, manau, kad tai yra atšokimas ir ignoravimas
jei (pertrauka_time - last_interrupt_time> 220) {
režimas ++;
tonas (6,2250,50);
jei (režimas> 2)
režimas = 0;
}
last_interrupt_time = pertrauka_time;
}
ilgas skaitymasVcc ()
apibrėžta (__ AVR_ATmega2560__) ADMUX = _BV (REFS0)
3 žingsnis: realizavimas
Schema ir PCB. Aš naudoju EAGLES, kad galėčiau realizuoti šemą ir PCB
gera gamybos vieta
jlcpcb.com/
Medžiagos sąrašas:
-1 Arduino mini pro 5v
http: //www.banggood.com/Wholesale-New-Ver-Pro-Min …
-1 0,96 colio OLED modulis 12864 128x64 geltona mėlyna SSD1306 vairuotojo I2C serijinė šviesos diodų plokštė Arduino avietėms PI arba kitiems
įspėjimas į poliškumą Gnd Vcc arba Vcc Gnd
http: //www.amazon.com/UCTRONICS-SSD1306-Self-Lumi …
http: //www.ebay.fr/itm/0-96-I2C-IIC-SPI-Serial-12 …
-1 LM317 LZ
http: //www.ebay.fr/itm/5Pcs-LM317LZ-LM317L-LM317 -…
http: //www.amazon.com/LM317LZ-Voltage-Regulator-I …
-1 MCP1702 5V
http: //www.ebay.fr/itm/Microchip-MCP1702-500-TO-9 …
http: //www.amazon.com/5002E-MCP1702-1702-5002E-MC …
-2x10K 2x470K 2x 47R 1 / 8W
-1x500R kintamasis TSR3386F 3/8
http: //www.ebay.fr/itm/Suntan-TSR3386F-3-8-1-turn …
-1x10K kintamasis TSR3386F 3/8
http: //www.ebay.fr/itm/Suntan-TSR3386F-3-8-1-turn …
-1xsitch įjungimas / išjungimas SS12D00G4 SPDT 1P2T 2 padėtis 3 kontaktų PCB
http: //www.ebay.fr/itm/20pcs-SS12D00G4-SPDT-1P2T -…
-2x 1µF tantale
-3x100nF
-1x1N4148
Galimas maitinimas 9V maitinimo elementu arba „3.7“
-1x3.7V 9V 5V 2A reguliuojamas žingsnis aukštyn 18650 ličio baterijos įkrovos išlydžio integruotas modulis
http: //www.banggood.com/3pcs-3_7V-9V-5V-2A-Adjust …
-1xLIPO maitinimo elementas 3.7V 400mAh
http: //www.ebay.fr/itm/Batterie-403035-Lipo-3-7v -…
4 veiksmas: kodo įkrovimas ir bandymas bei įdėjimas į dėžutę
Norėdami įkelti kodą, naudokite FTDI
ir bandymas su skirtingais LED ir diodais
padaryti langelį 3d spausdinti
patekti į dalyką:
www.thingiverse.com/thing:3594143
surinkti ir mėgautis
todėl šis projektas naudoja keletą programinės įrangos, todėl yra geras mokymo chalenge PCB kodas 3d elektroninis skaičiuoklė ir kt