Ja, dat is dus een "standaard" (lees: bestaande) library Weet jij overigens of er ook een schema van de DCC++ opstelling beschikbaar is ivm dat verschrikkelijke schild gedoe?Timo
Function Group One Instruction (100)4The format of this instruction is 100DDDDDUp to 5 auxiliary functions (functions FL and F1-F4) can be controlled by the Function Group One instruction. Bits0-3 shall define the value of functions F1-F4 with function F1 being controlled by bit 0 and function F4 beingcontrolled by bit 3. A value of "1" shall indicate that the function is "on" while a value of "0" shall indicate that thefunction is "off". If Bit 1 of CV#29 has a value of one (1), then bit 4 controls function FL, otherwise bit 4 has no meaning.
#define FUNCTIONS1 0B10000000/****** FUNCTIONS F1 - F4 *******/ packetFunctions1 = FUNCTIONS1; // mark this as instructions byte packetFunctions1 |= (train[addres].functions & 0x0F); // F1 - F4 ... ... if(train[addres].headLight) { packetSpeed |= (1<<4); // turns on headlight for 2200 packetFunctions1 |= (1<<4); } // should turn on headlight for 2400switch(packet){ // send 1 of 3 types of packets case speedPacket: bitArray[3] = packetSpeed; break; case functionPacket1: bitArray[3] = packetFunctions1; break; case functionPacket2: bitArray[3] = packetFunctions2; break; }
Ja, dat is dus een "standaard" (lees: bestaande) library Weet jij overigens of er ook een schema van de DCC++ opstelling beschikbaar is ivm dat verschrikkelijke schild gedoe?
Ik zou het wel mooi vinden om een DCC++ Centrale te maken met 1 pcb waar dan een arduino, een motorshield en een withrottle op zit.En dan in een zelfde kastje als de nieuwe DccNext van Nico Teering Tot nu toe heb ik zelf wel een DCC++ met een shield aan de praat, maar nog geen Withrottle.
Oef, 14 stappen, dat is wel weinig.
Als je de 2426 met 14 stappen DCC aan stuurt, weet je dan zeker dat hij niet sneller gaat? Het verschil is maar 1 stap (1/2 14-stap) dus makkelijk te missen.
En als je hem met MM2 aan stuurt dan geldt alles rond DCC natuurlijk simpelweg niet
Eerste wat me zo opvalt is dat je met die if()'s en die case eigenlijk dubbel werk aan het doen bent. Eerst alle mogelijke 3e byte's bepalen en er dan maar één gebruiken. Beetje zonde rekenwerk. Maar goed, kan ook aan de snippet liggen dat het zo lijkt.
Naar het probleem, hoe wat waar is FUNCTIONS1 gedefinieerd? Die zou 0x80 moeten zijn.
En als laatste, waarom is dit de vierde byte in de array? (bitArray[3]) Zou zeggen 0: AAAAAAAA, 1: CCCDDDDD, 2: EEEEEEEE.
...Ik weet niet meer welk draadje het was maar iemand heeft een bijna hele complete arduino base station gemaakt die met loconet en xpressnet kan werken en S88 dacht ik zelfs ook nog. ...
De L298 is een "dubbele" L6203.