Jasmine Karlsson
/
train_rail
New project
Diff: Train.cpp
- Revision:
- 23:bb57966cb776
- Parent:
- 21:31647d80614f
- Child:
- 24:418711ed8c52
--- a/Train.cpp Wed Jun 13 09:06:55 2018 +0000 +++ b/Train.cpp Wed Jun 13 20:50:26 2018 +0000 @@ -20,8 +20,10 @@ return position; } -void Train::goForward(){ - +void Train::sendCommand(){ + //lcd.cls(); + //lcd.printf("Send command"); + //lcd.printf("%d", inst); DCC_send_command(address, inst, nrPacket); } @@ -31,8 +33,8 @@ } void Train::Stop(){ - unsigned int stop = 0x40; - DCC_send_command(address, stop, nrPacket); + inst = 0x40; + DCC_send_command(address, inst, nrPacket); } unsigned int Train::getSpeed(){ @@ -42,6 +44,14 @@ void Train::setPosition(int pos){ position = pos; } + +bool Train::isClockwise(){ + return dirClockwise; +} + +void Train::changeDirection(){ + dirClockwise = !dirClockwise; +} bool Train::checkInterupt(int pos){ switch(pos){