ARDUINO Библиотека для ДВД-LED экран

KIPSA

✩✩✩✩✩✩✩
6 Фев 2020
9
0
Всем привет. Нужна Ваша помощь - уже несколько дней бьюсь без толку - не могу создать библиотеку для LED многосегментный экран, к контроллеру которого ещё и кнопки подключаются. Даташит на микросхему нашел, но как с ним общаться.... нужно на каждый сегмент подавать булевскую переменную из некой программы, а в ответ принимать булевское значение считанное с состояния кнопок, подключенных к микросхеме. При всём при этом ещё надо реализовать входящую переменную типа "string". В приложении даташит не родной, но очень похож на родной. Разница лишь в том, что в родном используется 7 семисегментных модулей, а в прикреплённом файле 4. Это передняя панелька с сегментами и кнопками от DVD плеера DVD-2800C.
 

Вложения

kalobyte

★★★✩✩✩✩
1 Янв 2020
726
146
этот драйвер аналог TM1628
для него есть библиотека давно
 

KIPSA

✩✩✩✩✩✩✩
6 Фев 2020
9
0
я пробывал подключать его, один сегмент зажигается и всё, никакой реакции ни на что нет
 

KIPSA

✩✩✩✩✩✩✩
6 Фев 2020
9
0
сейчас скопирую
/*
Library examples for TM1640.

Copyright (C) 2011 Ricardo Batista <rjbatista at gmail dot com>

This program is free software: you can redistribute it and/or modify
it under the terms of the version 3 GNU General Public License as
published by the Free Software Foundation.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <TM1638.h> // required because the way arduino deals with libraries
#include <TM1640.h>

// define a module on data pin 3, clock pin 2
TM1640 module(3, 2);

void setup()
{
// nothing to do here
}

void loop()
{
char text[17];

sprintf(text, "testing %u", millis());

module.setDisplayToString(text);
}

стандартный пример из этой библиотеки
 

KIPSA

✩✩✩✩✩✩✩
6 Фев 2020
9
0
А вот с этим примером, примерно 70 процентов сегментов горит постоянно без изменений на данный из ком порта

/*
Library examples for TM1638.

Copyright (C) 2011 Ricardo Batista <rjbatista at gmail dot com>

This program is free software: you can redistribute it and/or modify
it under the terms of the version 3 GNU General Public License as
published by the Free Software Foundation.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include <TM1638.h>
#include <TM1638QYF.h>

TM1638QYF module(3, 2, 4);
word mode;

unsigned long startTime;

void setup() {
startTime = millis();

module.setupDisplay(true, 7);
mode = 0;
}

void update(TM1638QYF* module, word* mode) {
word buttons = module->getButtons();
unsigned long runningSecs = (millis() - startTime) / 1000;

// button pressed - change mode
if (buttons != 0) {
*mode = buttons >> 1;

if (*mode < 128) {
module->clearDisplay();
delay(100);
}
}

switch (*mode) {
case 0:
module->setDisplayToDecNumber(runningSecs, 1 << 6);
break;
case 1:
module->setDisplayToDecNumber(runningSecs, 1 << 5, false);
break;
case 2:
module->setDisplayToHexNumber(runningSecs, 1 << 4);
break;
case 4:
module->setDisplayToHexNumber(runningSecs, 1 << 3, false);
break;
case 8:
module->setDisplayToBinNumber(runningSecs, 1 << 2);
break;
case 16:
char s[9];
sprintf(s, "Secs %03d", runningSecs % 999);
module->setDisplayToString(s, 1 << 1);
break;
case 32:
if (runningSecs % 2 == 0) {
module->setDisplayToString("TM1638QY", 1);
} else {
module->setDisplayToString(String("LIBRARY "), 1);
}
 

kalobyte

★★★✩✩✩✩
1 Янв 2020
726
146
какая-то странная библиотека
я думал там аргумент метода для отображения будет обычное число, а не строка

у тебя какие-то примеры левые
7 сегментник не может выводить текст
 

KIPSA

✩✩✩✩✩✩✩
6 Фев 2020
9
0
понятно, значит надо нормальную TM1638 качнуть, да?
 

KIPSA

✩✩✩✩✩✩✩
6 Фев 2020
9
0
поставил эту -<TM1638lite.h>, тот же результат

ладно, попробую "перепилить" её под себя
 

KIPSA

✩✩✩✩✩✩✩
6 Фев 2020
9
0
#include <TM1638.h>

bool Led1_207036119_1;
bool Led2_207036119_1;
bool Led3_207036119_1;
bool Led4_207036119_1;
bool Led5_207036119_1;
bool Led6_207036119_1;
bool Led7_207036119_1;
bool Led8_207036119_1;
String In_207036119_1;
String In2_207036119_1;
byte Light_207036119_1;
bool b1_207036119_1;
bool b2_207036119_1;
bool b3_207036119_1;
bool b4_207036119_1;
bool b5_207036119_1;
bool b6_207036119_1;
bool b7_207036119_1;
bool b8_207036119_1;
byte BYTE_out_207036119_1;
byte old_light_207036119_1;
byte old_length_207036119_1;
TM1638 module_207036119_1(3,2,4, true , Light_207036119_1 );
bool _stou1 = 0;

void setup()
{

Serial.begin(9600, SERIAL_8N1);


}
void loop()
{






//Плата:1
Led1_207036119_1 = 0;
Led2_207036119_1 = 1;
Led3_207036119_1 = 0;
Led4_207036119_1 = 0;
Led5_207036119_1 = 0;
Led6_207036119_1 = 0;
Led7_207036119_1 = 0;
Led8_207036119_1 = 0;
In_207036119_1 = String("5");
In2_207036119_1 = String("6");
Light_207036119_1 = 5;
BYTE_out_207036119_1=module_207036119_1.getButtons();
b1_207036119_1 = bitRead(BYTE_out_207036119_1, 0);
b2_207036119_1 = bitRead(BYTE_out_207036119_1, 1);
b3_207036119_1 = bitRead(BYTE_out_207036119_1, 2);
b4_207036119_1 = bitRead(BYTE_out_207036119_1, 3);
b5_207036119_1 = bitRead(BYTE_out_207036119_1, 4);
b6_207036119_1 = bitRead(BYTE_out_207036119_1, 5);
b7_207036119_1 = bitRead(BYTE_out_207036119_1, 6);
b8_207036119_1 = bitRead(BYTE_out_207036119_1, 7);

module_207036119_1.setLED(Led1_207036119_1, 0); // 1 цвет светодиода, 2 номер светодиода от 0 до 7
module_207036119_1.setLED(Led2_207036119_1, 1); // 1 цвет светодиода, 2 номер светодиода от 0 до 7
module_207036119_1.setLED(Led3_207036119_1, 2); // 1 цвет светодиода, 2 номер светодиода от 0 до 7
module_207036119_1.setLED(Led4_207036119_1, 3); // 1 цвет светодиода, 2 номер светодиода от 0 до 7
module_207036119_1.setLED(Led5_207036119_1, 4); // 1 цвет светодиода, 2 номер светодиода от 0 до 7
module_207036119_1.setLED(Led6_207036119_1, 5); // 1 цвет светодиода, 2 номер светодиода от 0 до 7
module_207036119_1.setLED(Led7_207036119_1, 6); // 1 цвет светодиода, 2 номер светодиода от 0 до 7
module_207036119_1.setLED(Led8_207036119_1, 7); // 1 цвет светодиода, 2 номер светодиода от 0 до 7

byte length_in = ( ((In2_207036119_1)).length() *16+((In_207036119_1)).length());
if ( old_length_207036119_1 > length_in ) {
module_207036119_1.clearDisplay();}
old_length_207036119_1 = length_in;
module_207036119_1.setDisplayToString( In_207036119_1 );
module_207036119_1.setDisplayToString( In2_207036119_1 ,0,4);

// тест яркости
if ( old_light_207036119_1 != Light_207036119_1 ) { TM1638 module_207036119_1(3,2,4, true , Light_207036119_1 ); old_light_207036119_1 = Light_207036119_1; }
if (1){if (!_stou1){Serial.write(BYTE_out_207036119_1); Serial.println(""); _stou1=1;}} else {_stou1=0;}






}
и так тоже лажа какая то
 

Shalom

✩✩✩✩✩✩✩
23 Мар 2019
21
3
Омск
@kalobyte, на семисегментник можно выводить текст, что в примере и показанно.
Автор, посмотри вот тут 24 сообщение.
 

KIPSA

✩✩✩✩✩✩✩
6 Фев 2020
9
0
@kalobyte, на семисегментник можно выводить текст, что в примере и показанно.
Автор, посмотри вот тут 24 сообщение.
спасибо Вам большое. Изучил ветку форума, вот по этой ссылке http://arduino.ru/forum/proekty/korpus-ot-drs-8300-v-arduino-proektakh нашол то что нужно, только осталось допилить адреса по мой экранчик.