Notifications
Clear all

Model Rail Block detection sketch

2 Posts
2 Users
0 Likes
1,116 Views
(@john40131)
Member
Joined: 5 years ago
Posts: 95
Topic starter  

Hi, I hope someone can help me to change a sketch I have for controlling a set of points, and Signal LEDs ...

The sketch I have has most of the Mega pins used for 6 detection Blocks,Signals and IR Sensors and in each block various Points and Signals will change when an Entry sensor is triggered ... the problem I have is all the blocks are in 1 void Loop and if I select Block Detect 1 IR sensor goes LOW points and signals I have setup are triggered and when it Exits block all signals and points go back to normal .... If I know detect Block 2 everything works fine but one of the points which is the point that was used in Block 1 is now LOW so the same point that is in Block 2 goes HIGH and then because the loop is a loop it sees Block 1 (same point) is LOW so turns off ... I want to change the Void Loop to a StateMachine or Switch case but because I have 10 possible Entry sensors I am unsure how to start the sketch for the Switch(case)..

Can anyone help with this

Regards John


   
Quote
(@sj_h1)
Member
Joined: 4 years ago
Posts: 167
 

There have been numerous videos on how to use Arduinos on a model railroad. I would be happy to help you but I am just not following your description. It sounds like all your block detects are tried together? It sounds like you have some code already written perhaps if you share it I could help and/or a diagram of your layout with the sensor locations marked. You can attach a file to the reply 

  


   
ReplyQuote