;#picaxe 20M2 '---------------------------- ' Codetabelle 6 x 4 = 24 Einträge '---------------------------- data 0,(1,2,3,4) data 4,(5,6,7,8) data 8,(9,10,11,12) data 12,(13,14,15,16) data 16,(17,18,19,20) data 20,(21,22,23,254) symbol row = b0 symbol col = b1 symbol index = b2 symbol key = b3 symbol lastkey = b4 symbol Port_Adr=$40 dirsB = %01011111 ' B0-B4 + B6 Ausgang dirsC = %00000000 ' C0-C3 Eingang ;PCF8574P adresse=$20 ' I2C Master hi2csetup i2cmaster,Port_Adr,i2cslow,i2cbyte ;lastkey = 255 ;hi2cout 0,(key) ;hi2cout (key) dieser Port main: key = 255 for row = 0 to 5 high B.0 high B.1 high B.2 high B.3 high B.4 high B.6 select case row case 0 low B.0 case 1 low B.1 case 2 low B.2 case 3 low B.3 case 4 low B.4 case 5 low B.6 endselect pause 1 if pinC.0 = 0 then col = 0 goto gotkey endif if pinC.1 = 0 then col = 1 goto gotkey endif if pinC.2 = 0 then col = 2 goto gotkey endif if pinC.3 = 0 then col = 3 goto gotkey endif next row goto nokey gotkey: index = row * 4 + col read index,key if key <> lastkey then sertxd("Code=",#key,13,10) ' Tastencode über I2C senden hi2cout(0,key) lastkey = key endif pause 30 goto main nokey: lastkey = 255 pause 10 goto main