Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read keycode #1

Open
marlumme opened this issue Sep 16, 2016 · 4 comments
Open

Read keycode #1

marlumme opened this issue Sep 16, 2016 · 4 comments

Comments

@marlumme
Copy link

This is not issue but a new feature.
TM1650 has also a key scan of the digits 1-4 connected to segments A-G with a 2k resistor.
The code can be retrieved by reading from address 0x24, control port.
When there is valid code bits 2 and 6 are set. The codes are listed in the TM1650 manual.
I checked this with 4-digit bought from ebay.
Please add the code in your repository. It seems to be the one what people are browsing.

wbr
Martti

@arkhipenko
Copy link
Owner

I have actually never been able to find a tm1650 manual, so the entire library was built by trial an error. Do you mind sharing it with me? arkhipenko@hotmail.com

Since I don't have the manual, I am not sure what key scan functionality you are referring to... Happy to add to the library once I understand what it is.

Sent from a mobile device. Apologies for accidental typos.

From: marlumme
Sent: Friday, September 16, 2:46 AM
Subject: [arkhipenko/TM1650] Read keycode (#1)
To: arkhipenko/TM1650

This is not issue but a new feature.
TM1650 has also a key scan of the digits 1-4 connected to segments A-G with a 2k resistor.
The code can be retrieved by reading from address 0x24, control port.
When there is valid code bits 2 and 6 are set. The codes are listed in the TM1650 manual.
I checked this with 4-digit bought from ebay.
Please add the code in your repository. It seems to be the one what people are browsing.

wbr
Martti

You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHubhttps://github.com//issues/1, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AATGTVOBMCi0HIXjE3HI7mGYVDgvo2OMks5qqjtMgaJpZM4J-o80.

@marlumme
Copy link
Author

I found it on the manufacture’s site http://www.titanmic.com/e_products/TM1650-2-25.html
unfortunately it is china, but fortunately we have google translate.

The code is here

int TM1650::keycode() {
byte x;
Wire.requestFrom(TM1650_DCTRL_BASE,1,true); //
x = Wire.read();
return x&0x40?x:0; // returns 0 if no key pressed

}

I also added to my version displayInt, because this is digit display

int TM1650::displayInt(int aI) {
int i;
char neg=0;
if(aI>9999){
displayString("+Err");
return 1;
}
if(aI<-999){
displayString("-Err");
return -1;
}
if(aI<0){
aI=-aI;
neg=1;
}
for(i=3;i>=0;i--){
setPosition(i,aI?pgm_read_byte_near(TM1650_CDigits + aI%10+'0'):(i==3?0x3f:0));aI/=10;
if(neg) setPosition(0,64);
}
return 0;

}

On 16 Sep 2016, at 15:35, Anatoli Arkhipenko notifications@github.com wrote:

I have actually never been able to find a tm1650 manual, so the entire library was built by trial an error. Do you mind sharing it with me? arkhipenko@hotmail.com

Since I don't have the manual, I am not sure what key scan functionality you are referring to... Happy to add to the library once I understand what it is.

Sent from a mobile device. Apologies for accidental typos.

From: marlumme
Sent: Friday, September 16, 2:46 AM
Subject: [arkhipenko/TM1650] Read keycode (#1)
To: arkhipenko/TM1650

This is not issue but a new feature.
TM1650 has also a key scan of the digits 1-4 connected to segments A-G with a 2k resistor.
The code can be retrieved by reading from address 0x24, control port.
When there is valid code bits 2 and 6 are set. The codes are listed in the TM1650 manual.
I checked this with 4-digit bought from ebay.
Please add the code in your repository. It seems to be the one what people are browsing.

wbr
Martti

You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHubhttps://github.com//issues/1, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AATGTVOBMCi0HIXjE3HI7mGYVDgvo2OMks5qqjtMgaJpZM4J-o80.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub #1 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/AVI2EwJGDcQGbFj0x1Xw850rQM4SnmELks5qqo0pgaJpZM4J-o80.

@marlumme
Copy link
Author

Here original and rough translate

Martti

nicholascw added a commit to nicholascw/TM1650 that referenced this issue Jan 10, 2018
@OmarMGhanem
Copy link

I tried to add the mentioned code but it only run for on time then my loop don't work

I restarted the boar but this loop work only once if I remove the getKeycode function it works fine

and even I've edit the headers file to check it steams to stop workin after calling Wire.requestFrom(TM1650_DCTRL_BASE, 1, true); .

 #include <Wire.h>
#include <TM1650.h>

TM1650 d;

void setup() 
{
  Wire.begin(); //Join the bus as master

  Serial.begin(9600); //Start serial communication at 9600 for debug statements
  Serial.println("TM1650 Example Code");

  d.init();
   
}

void loop() 
{
  d.displayOff();
  d.displayString("Omar");
  d.setBrightness(TM1650_MIN_BRIGHT);
  d.displayOn();
  delay(100);
  char line[] = "Omar";
  int  key  ;

  delay(200);
  d.displayString("OLAL");
  delay(200);
Serial.println("Reading From keys");
key = d.getKeycode();
delay(200);



  
  }

  




Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants