TM1650 icon indicating copy to clipboard operation
TM1650 copied to clipboard

Read keycode

Open marlumme opened this issue 9 years ago • 4 comments
trafficstars

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

marlumme avatar Sep 16 '16 06:09 marlumme

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? [email protected]

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/arkhipenko/TM1650/issues/1, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AATGTVOBMCi0HIXjE3HI7mGYVDgvo2OMks5qqjtMgaJpZM4J-o80.

arkhipenko avatar Sep 16 '16 12:09 arkhipenko

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 [email protected] 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? [email protected]

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/arkhipenko/TM1650/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 https://github.com/arkhipenko/TM1650/issues/1#issuecomment-247589613, or mute the thread https://github.com/notifications/unsubscribe-auth/AVI2EwJGDcQGbFj0x1Xw850rQM4SnmELks5qqo0pgaJpZM4J-o80.

marlumme avatar Sep 16 '16 15:09 marlumme

Here original and rough translate

Martti

marlumme avatar Sep 17 '16 05:09 marlumme

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



  
  }

  




OmarMGhanem avatar Jul 08 '21 13:07 OmarMGhanem