Dus geen wijziging in de originele sketch
char tastaturinput = keypad.getKey(); if (tastaturinput != NO_KEY) { int ziel = (tastaturinput - '0');
#include <NmraDCC.h> // bask185: library must be installed into arduino IDENmraDcc dcc ; // bask185: DCC PIN MUST BE CONENCTED TO ARDUINO PIN 2
char dccChar ; // global variable used to relay DCC information to the turntable control functions
dcc.init( MAN_ID_DIY, DCC_DECODER_VERSION_NUM, FLAGS_OUTPUT_ADDRESS_MODE | FLAGS_DCC_ACCESSORY_DECODER, 0 ); // bask185: init DCC library
char tastaturinput = keypad.getKey(); dccChar = 0 ; // bask185: reset every cycle dcc.process() ; // process DCC packets if( dccChar != 0 ) tastaturinput = dccKey ; // if valid DCC instruction is received, copy it to 'tastaturinput' if (tastaturinput != NO_KEY) {
void notifyDccAccTurnoutOutput ( uint16 Addr, uint8 Direction, uint8 OutputPower ) // bask185: this is called when accessory is set{ switch( Addr ) { case 100: if( Direction == 1 ) dccChar = '0' ; // DCC accessory address 100 straight else dccChar = '1' ; // DCC accessory address 100 curved break ; case 101: if( Direction == 1 ) dccChar = '2' ; else dccChar = '3' ; break ; case 102: if( Direction == 1 ) dccChar = '4' ; else dccChar = '5' ; break ; case 103: if( Direction == 1 ) dccChar = '6' ; else dccChar = '7' ; break ; case 104: if( Direction == 1 ) dccChar = '8' ; else dccChar = '9' ; break ; }}
byte rowPins[ROWS] = {2, 3, 4, 5}; //connect to the row pinouts of the keypad bask185: pin 2 wordt gebruikt voor DCC, je moet andere pinnen gebruikenbyte colPins[COLS] = {6, 7, 8, 9}; //connect to the column pinouts of the keypad