アルドゥイーノLEDテスター:5つのステップ

アルドゥイーノLEDテスター:5つのステップ

目次:

Anonim

小型LEDテスタープロジェクト

私はNETでLEDテスターを探していました、そして私がゼロからこのテスターを作りたかったという考えを見た後

用品:

ステップ1:スキーマ

LEDをテストするには、電流発生器が必要です。

LM317LZデータシートは地図を提供しています、基本的なアイデアのウェブサイトを見てください

www.robotroom.com/LED-Tester-Pro-1.html

このサイトから利用可能なコードはありません

したがって、原理はLEDの端子でいくつかの電圧を測定することです

VHアノード電圧VLカソード電圧とその減算値(VH - VL)

次に、LEDの電流ILを横切り、その値Rで除算した抵抗の端子の電圧を測定します(VR / R = IL)。

ステップ2:Arduinoをコード化する

Arduinoのコードでは、基本的な考え方が定義されています。私はOLEDスクリーンにディスプレイを表示したいと思いました。

ライブラリはssd1306用です

github.com/adafruit/Adafruit_SSD1306

さまざまな電圧を測定するには

http://www.instructables.com/id/Arduino-OLED-Volt …

さまざまなメニューの選択については

it-edukacija.eu.hr/multidruino/default.html

アイコンを作成するには

javl.github.io/image2cpp/

テストボードでテストに合格

ここにコード:

// ================================================

//作者:PHILOUPAT

//火星2019 //バージョン1:1つのボタン、表示モードOLED I2C、AREFデフォルト// ================================ ===================

// I2C OLEDディスプレイ:SCL = A5、SDA = A4

//計算用のA0入力リファレンスRL

// A1入力Vbat

// A2入力VL

// A7入力VH

// ================================================

#含める

#含める

#含める

#含める

#含める

#含める

#define SSD1306_128_64

#define SCREEN_WIDTH 128

// OLEDディスプレイの幅、ピクセル単位

#define SCREEN_HEIGHT 64

// OLEDディスプレイの高さ、ピクセル単位

// I2Cに接続されたSSD1306ディスプレイの宣言(SDA、SCLピン)

#define OLED_RESET -1 //リセットピン#(またはArduinoリセットピンを共有する場合は-1)

Adafruit_SSD1306ディスプレイ(SCREEN_WIDTH、SCREEN_HEIGHT、&Wire、OLED_RESET)。

#define XPOS 0

#define YPOS 1

#define DELTAY 2

//#if(SSD1306_LCDHEIGHT!= 64)

//#エラー( "高さが正しくありません。Adafruit_SSD1306.hを修正してください。");

//#endif

const unsigned char PROGMEM batterie = {

0x00、0x00、0x00、0x00、0x00、0x00、0x00、0x00、0x00、0x00、0x00、0x00、0x00、0x00、0x3f、0xff、0xff、0xfe、0x00、0x20、0x00、0x00、0x02、0x00、 0x20、0x00、0x00、0x02、0x00、0x00、0x00、0x02、0x00、0x20、0x00、0x00、0x03、0xe0、0x20、0x00、0x00、0x02、0x20、0x24、0x00、0x82、0x82、0x20 0x24、0x00、0x01、0xe2、0x20、0x24、0x00、0x00、0x82、0x20、0x20、0x00、0x00、0x82、0x20、0x20、0x00、0x03、0x20、0x00、0x00、0x03、0x00 0x20、0x00、0x00、0x02、0x00、0x00、0x00、0x02、0x00、0x3f、0xff、0xff、0xfe、0x00、0x00、0x00、0x00、0x00、0x00、0x00、0x00、0x00、0x00、0x00 0x00、0x00、0x00、0x00、0x00}。

const unsigned char PROGMEM抵抗 = {

0x00、0x00、0x00、0x00、0x00、0x00、0x00、0x00、0x00、0x00、0x00、0x00、0x00、0x00、0x00、0x00、0x18、0x00、0x00、0x18、0x00、0x00、 0x00、0x10、0x00、0x00、0x00、0x00、0x00、0x00、0x30、0x00、0x00、0x00、0x30、0x00、0x00、0x30、0x00、0x00、0x30、0x00、0x00、0x00、 0x3cのは0x20、0x00に、0x00で、0x00に、0x20に、0x00で、0x00に、0x00に、0x60、0x00に、0x00に、0x00に、0x60、0x00に、0x00に、0x00に、0x60、0x00に、0x00に、0x00に、0x60、0x00に、0x00に、0x00に、 0x00、0x00、0x00、0x0f、0x00、0x00、0x00、0x7f、0x80、0x00、0x3f、0xf8、0x00、0x7、0x00、0x00、0x00、0x00、0x00、0x00、0x80、0x80、0x80、0x80 0x00、0x00、0xe0、0x00、0x00、0x38、0x00、0x00、0x00、0x1f、0x00、0x00、0x07、0xfe、0x00、0x00、0xff、0x80、0x00、0x78、0x00、0x00、0x00、0x00 0x1e、0x00、0x00、0x00、0x07、0x80、0x00、0x00、0x01、0xe0、0x00、0x00、0x00、0x78、0x00、0x00、0x00、0x7e、0x00、0x00、0x3f、0x00、0x01、0xf、 0x00、0x00、0x00、0x70、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、0x00、0x00、0x00、0xe0、0x00、0x00、0x00、0x38、0x00、0x00 0x00、0x0c、0x00、0x00、0x00、0x00、0x00、0x08、0x00、0x00、0x00、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、0x30、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、0x 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、0xff、0xff、0xff、0xff、0xff、0xff、0xff 0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff 0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff 0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff 0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff 0xff、0xff、0xff、0xff、0xff、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 PROGMEM = {

0x00、0x00、0x00、0x00、0x0c、0x30、0x18、0x18、0x0c、0x30、0x0c、0x30、0x30、0x0c、0x30、0x0c、0x18、0x0c、0x08、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、0x0f、0xe0、0x00、0x00、0x3f、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、0xff、0xc0、0x07、0xff、 0xff、0xc0、0x07、0xff、0xff、0xc7、0xff、0xff、0xc0、0x07、0xff、0xff、0xc7、0xff、0xff、0xc0、0x07、0xff、0xff、0xff、0xff、0xff、0xff 0xc0、0x07、0xff、0xff、0xc0、0xff、0xff、0xc0、0x00、0x00、0x00、0x00、0x00、0x00、0x00、0x1f、0xf7、0xf0、0x1f、0xff、0xff、0xff、0xf8、 0x1f、0xff、0xff、0xf8、0x1f、0xff、0xff、0xf8、0x1f、0xff、0xff、0xf8、0x1f、0xff、0xff、0xf8、0x1f、0xff、0xff、0xf8、0xff、0xff、0xf0、0x00、 0x00、0x00、0x00、0x00、0x00、0x00、0x00、0xe0、0x0e、0x00、0x01、0xe0、0x00、0x00、0xe0、0x0e、0x00、0x01、0xe0、0x0e、0x00、0x01、0xe0、 0x0e、0x00、0x00、0xe0、0x0e、0x00、0x01、0xe0、0x0e、0x00、0x01、0xe0、0x0e、0x00、0x01、0xe0、0x0e 、0x00、0x00、0xe0、0x0e、0x00、0x00、0xe0、0x0e、0x00、0x00、0xc0、0x0e、0x00、0x00、0xc0、0x0c、0x00、0x00、0x04、0x00、0x00、0x00、0x0c、0x00、0x00 、0x00、0xc0、0x0c、0x00、0xc0、0x0c、0x00、0x00、0xc0、0x0c、0x00、0x00、0x04、0x00、0x00、0x40、0x04、0x00、0x00、0x00、0x00、0x00、0x00 、0x00、0x04、0x00、0x00、0x00、0x004、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、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、0xff、0xff、0xff、0xff、0xff、0xff、0x80、0x01、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff 0xff、0xff、0xff、0xff、0x00、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xfe、0x00、0x00、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、0xfc、0x00、0x00、0x7f、0xff、0xff、0xff、0xff、0xff、0xff、0xf1、0xd8、0xff、0xff、0xff、0xff、0xff 、0xfc、0x00、0x00、0xff、0xff、0xff、0xff、0xff、0xff、0xf0、0xc1、0xd9、0x83、0xff、0xff、0xfc、0x00、0x3f、0xff、0xff、0xff、0xff、0xff、0xff、0xff 、0xff、0xe6、0xff、0xf9、0x83、0xff、0xff、0xfc、0x00、0x00、0x3f、0xff、0xff、0xff、0xff、0xff、0xff、0xc4、0xe1、0xb9、0x83、0xff、0xff、0xf8、0x00 0x00、0x3f、0xff、0xff、0xff、0xff、0xff、0xff、0xc4、0xf9、0xb1、0xa3、0xff、0xfc、0x00、0x00、0x3f、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff 、0x83、0xf3、0x07、0xff、0xff、0xfc、0x00、0x00、0x3f、0xff、0xff、0xff、0xff、0xff、0xff、0xe1、0x83、0x73、0xff、0xff、0xff、0xf、0x00、0x00、0x3f 、0xff、0xf3、0xf8、0x02、0xff、0xff、0xff、0x7f、0xff、0xff、0xff、0xfc、0x00、0x00、0x3f、0xff、0xe3、0xf8、0x01、0xff、0xff、0xff、0xff、0xff、0xff 、0xff、0xff、0xff、0xfc、0x00、0x00、0x3f、0xff、0xe3、0xf1、0xfc、0x30、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、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff 0xf3、0xbc、0x7c、0x7f、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xc7、0xe0、0x1c、0x7c、0x7f、0xff、0xff、0xff、0xff、0xff、0xff、0xff 0xff、0xf0、0x04、0x00、0x0f、0xff、0xc7、0xe0、0x3c、0x7c、0x7f、0xff、0xff、0xff、0xff、0xff、0xff、0xf0、0x00、0x00、0x07、0xff、0xcf、0xe1、0xfc、 0x7c、0x7f、0xff、0xff、0xff、0xff、0xff、0xe0、0x00、0x00、0x07、0xff、0x8f、0xe3、0xf8、0x7c、0x7f、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xe0、 0x00、0x00、0x07、0xff、0x8f、0xc7、0xf8、0xf8、0x7f、0xff、0xff、0xff、0xff、0xff、0xe0、0x00、0x00、0x07、0xff、0x8f、0xf8、0xf0、0x7f、 0xff、0xff、0xff、0xff、0xff、0xff、0xf0、0x00、0x00、0x07、0xff、0x88、0x07、0x88、0x60、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xf0、0x00、0x00、0x00、 0x07、0xff、0x80、0x00、0x01、0xff、0xff、0xff、0xff、0xff、0xff、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、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、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、0x1f、0xf0、0xff、0xff、0xec、0x01、0xc0、0xe0、0x1c、0x01、0x0f、0x18、0xff、0xff、0xff、0xff、0xff 0x1f、0xf0、0xff、0xff、0x80、0x04、0x03、0x00、0x00、0x04、0x01、0x1f、0x98、0xff、0xff、0x1f、0xf0、0xff、0x88、0x88、0x88、0xfe、0x1e、0x00、 0x40、0xff、0x1f、0x90、0xe1、0xff、0xff、0x1f、0xf0、0xff、0xff、0x38、0xf8、0xfe、0x3f、0xb8、0xf8 、0xfe、0x1f、0x91、0xff、0xff、0x1f、0xf0、0xff、0xff、0xf9、0xf8、0xfe、0x3f、0xf8、0xf8、0xfe、0x3f、0x91、0xc3、0xff、0x1f、0xf9、0xff 、0xff、0xf1、0xf0、0x0f、0x07、0xf8、0xf8、0x3f、0x93、0x87、0xff、0xff、0x1f、0xf9、0xff、0xff、0xf1、0xf0、0x1f、0xf0、0x0e、0x3f 、0xa0、0x0f、0xff、0xff、0x9f、0xf9、0xff、0xff、0xf1、0xf0、0xff、0xf8、0x70、0xf0、0xfe、0x3f、0x20、0x1f、0xff、0xff、0xf9、0xff、0xff、0xf1 、0xf1、0xff、0xfc、0x71、0xf1、0xfe、0x3f、0x20、0xff、0xff、0xff、0x9f、0xf9、0xff、0xe1、0xe3、0xfd、0xfc、0x71、0xf3、0x23、0x8f 、0xff、0xff、0xbf、0xf9、0xff、0xe1、0xe3、0xfc、0xf8、0x61、0xe3、0xfe、0x1e、0x63、0x87、0xff、0xff、0x9f、0xf9、0xff、0xe1、0xe3、0xc4 、0x00、0x61、0xe1、0xc6、0x00、0x63、0xc7、0xff、0x9f、0xf9、0xff、0xff、0xe1、0xe0、0x04、0xe1、0xe0、0x07、0x03、0xc3、0xff、0xff、0xff 0x9f、0xf9、0xff、0xff、0xe1、0xe0、0x07、0x03、0xe1、0xe0、0x07、0x01、0xc3、0xc3、0xff、0xff、0x 9f、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、0xf9、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xf、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、0xff、0xff 0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff 0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff 0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、 0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、0xff、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モード= 0。

int pause = 500;

int RL = 0。

int R1 = 10000;

int R2 = 10000。

int R3 = 47;

float raw = 0。

float val = 0。

float ref = 0。

float vbat = 0。

float vin = 0.00。

フロートvoutL = 0.00。

フロートvoutH = 0.00。

float vref = 0.00。

float vled = 0.00。

float vr = 0.00。

フロートIL = 0.00。

float vinref = 0.00。

float vinbat = 0。

void setup()

{

pinMode(5、INPUT_PULLUP);

pinMode(4、INPUT_PULLUP);

pinMode(3、INPUT_PULLUP);

attachInterrupt(1、ブートン、FALLING);

//デフォルトでは、3.3Vラインから内部で高電圧を生成します。 (きちんとした!)display.begin(SSD1306_SWITCHCAPVCC、0x3C); // I2Cアドレス0x3Cで初期化(128x32用)

}

void loop()

{

float vref = readVcc()/ 1000.0;

val = analogRead(A7);

raw = analogRead(A2);

voutH =(val * vref)/ 1024.0。 //本文を参照

voutL =(生* vref)/1024.0。

if(voutL> 0)

{

if(mode == 0)// caracteristiqueが導いた

{

float vref =(readVcc()/ 1000.0);

val = analogRead(A7);

raw = analogRead(A2);

ref = analogRead(A0);

voutH =(val * vref)/ 1024.0。 //本文を参照

voutL =(生* vref)/1024.0。

vled =(voutH − voutL)*(R1 + R2)/ R2。

vr = voutL。

IL = vr / R3。

display.clearDisplay();

display.setTextColor(WHITE);

display.drawBitmap(96、0、led、32、64、1);

display.setFont();

display.setFont(&FreeSans9pt7b);

display.setCursor(0,12);

display.print( "LED機能");

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();

遅延(一時停止)。

}

if(mode == 1)

{//抵抗

float vref =(readVcc()/ 1000.0);

val = analogRead(A7);

raw = analogRead(A2);

ref = analogRead(A0);

voutH =(val * vref)/1024.0。

voutL =(生* 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、レジスタ、32、64、1);

display.setFont();

display.setFont(&FreeSans9pt7b);

display.setCursor(0,12);

display.print( "Resistance:");

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:");

if(RL <0)

{

display.setCursor(30,60);

display.print( "empty");

}

それ以外の

{

display.setCursor(30,60);

display.print(RL);

display.drawBitmap(73、46、oms、15、15、1);

}

display.display();

遅延(一時停止)。

}

if(mode == 2)

{// baterie

float vref =(readVcc()/ 1000.0);

vbat = analogRead(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");

if(vinbat> 0 && vinbat <7.0)

{// 1小節

display.fillRect(20,45,10,15、BLACK);

}

それ以外の場合(vinbat> 7.0 && vinbat <7.8)

{// 2小節

display.fillRect(20,45,10,15、BLACK);

display.fillRect(30,45,5,15、WHITE);

display.fillRect(35,45,10,15、BLACK);

}

それ以外の場合(vinbat> 7.8 && vinbat <8.4)

{// 3小節

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);

}

そうでなければ(vinbat> 8.4 && vinbat <8.7)

{// 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);

}

それ以外の場合(vinbat> 8.7 && vinbat <9.0)

{// 5小節

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);

}

それ以外の場合(vinbat> 9.0 && vinbat <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();遅延(一時停止)。 }

その他

{

display.clearDisplay();

display.drawBitmap(0、0、accueil、128、64、1);

display.display();

遅延(700)。

display.display();

遅延(1000)。

}

}

無効ボタン()

{

静的符号なしlong last_interrupt_time = 0。

unsigned long interrupt_time = millis();

//割り込みが200msより速くなった場合、それがバウンスであるとみなして無視します

if(interrupt_time - last_interrupt_time> 220){

mode ++;

トーン(6,2250,50);

if(モード> 2)

モード= 0。

}

last_interrupt_time = interrupt_time;

}

long readVcc()

定義済み(__ AVR_ATmega2560__)ADMUX = _BV(REFS0)

ステップ3:実現

回路図とPCB私はshemとpcbを実現するためにEAGLESを使います

製造のための良い場所

jlcpcb.com/

材料のリスト:

-1 Arduinoミニプロ5v

http://www.banggood.com/Wholesale-New-Ver-Pro-Min …

-1 0.96インチOLEDモジュール12864 128 x 64イエローブルーSSD 1306ドライバI 2 Cシリアル自発光ディスプレイボード用ArduinoラズベリーPIまたは他

極性への警告Gnd Vccまたは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-電圧 - レギュレータ - I …

-1 MCP1702 5V

http://www.ebay.fr/itm/Microchip-MCP1702-500-TO-9 …

http://www.amazon.com/5002E-MCP1702-1702-5002E-MC …

-2×10K 2×480K 2×47R 1 / 8W

-1×500R可変TSR3386F 3/8

http://www.ebay.fr/itm/Suntan-TSR3386F-3-8-1-turn …

-1×10K可変個TSR3386F 3/8

http://www.ebay.fr/itm/Suntan-TSR3386F-3-8-1-turn …

-1×スイッチオン/オフSS12D00G4 SPDT 1P2T 2ポジション3ピンPCB

http://www.ebay.fr/itm/20pcs-SS12D00G4-SPDT-1P2T -…

-2×1µFタンタル

-3×100nF

-1×1N4148

9Vバッテリーまたはバッテリーリポ3.7Vで可能な電力

-1x3.7V 9V 5V 2A調整可能ステップアップ18650リチウム電池充電放電内蔵モジュール

http://www.banggood.com/3pcs-3_7V-9V-5V-2A-調整…

-1xLIPO電池3.7V 400mAh

http://www.ebay.fr/itm/Batterie-403035-Lipo-3-7v -…

ステップ4:コードのロードとテストとボックスへの格納

コードを読み込むにはFTDIを使います

さまざまなLEDやダイオードでテスト

ボックスを3Dプリントする

thingverseに着く:

www.thingiverse.com/thing:3594143

組み立てて楽しむ

このプロジェクトは、いくつかのソフトウェアを使用しているので、良い教育チャレンジPCBコード3D電子計算機などです。

ステップ5: