Closed fire-bot closed 1 year ago
You may be missing the WAITFOR command https://dcc-ex.com/ex-rail/EX-RAIL-command-reference.html#waitfor-pin-the-waitfor-command-instructs-ex-rail-to-wait-for-a-servo-motion-to-complete-prior-to-continuing
and the examples at that link: `// First example defines a servo turnout/point for the coal yard and a signal for the main line. TURNOUT(100, 26, 0, "Coal Yard") SIGNAL(25, 26, 27)
// When our turnout/point is closed, the main line is open, so the signal is green. ONCLOSE(100) GREEN(25) DONE
// When our turnout is closed, the main line is interrupted, so the signal is red. ONTHROW(100) RED(25) DONE
// This example triggers an automation sequence when a DCC accessory decoder is activated, including waiting for SERVO motions to complete. ONACTIVATEL(100) // Activating DCC accessory decoder with linear address 100 commences the sequence. SERVO(101, 400, Slow) // Move the first servo and wait. WAITFOR(101) SERVO(102, 300, Medium) // Move the second servo and wait. WAITFOR(102) SET(165) // Activate a Vpin to turn an LED on. SET(166) // Activate a second Vpin to turn a second LED on. DONE`
Ash, Thanks for assistance. I'm actually looking at controlling the servo, which I can do, to hit a limit switch and that will be the indication that the switch was successful and change the light. The problem I'm having is when the limit switch closes it doesn't register on the arduino as the switch closed. The limit switch would be wired N.O. at the beginning so that depending on the state of the switch the lights would be the proper color when I turn on the layout. It's really small switching layout but I wanted to pack all the fun stuff into it to learn and have fun with a DCC system.
How do I get it to read the switch closure on the particular pin I'm hooked to for that input? Also where would this all be put, maybe I'm assigning it to the wrong file. I just want to watch these pins for switch closures and control the switches via my app (Engine Driver), the servos work great in the app and run great, just need to find the proper degrees but that's easy.
Perhaps this will help.
Wiring sensors to pins or I2C modules https://dcc-ex.com/ex-rail/creating-elements.html#adding-sensors
You can add sensor definitions in mySetup.h, if you want to see their state change in the serial monitor. (EXRAIL does not require sensors to be pre-defined.) https://dcc-ex.com/reference/software/command-summary-consolidated.html#s-id-vpin-pullup-create-a-new-sensor-id
If you do not already have the mySetup.h file https://dcc-ex.com/ex-commandstation/advanced-setup/startup-config.html#creating-the-mysetup-h-file
Suggest reviewing the examples and instructions on the dcc-ex.com website. Join the discussion on discord. open a ticket, or get assistance in the #sensors channel. https://discord.gg/PuPnNMp8Qf
Why is this so difficult? I created a mySetup.h file. I put some commands in it and I get errors. I want to monitor a simple switch closure TO START, I want to control servos in the end. This is the 2 lines in my mySetup.h file. SETUP("<1>"); // Turn track power on at startup SETUP("<S 1000 40 1">);
In file included from C:\Users\XXXX\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino/Arduino.h:28:0,
from C:\Users\XXXX\AppData\Local\Temp\arduino\sketches\46BA07B936EF82FC9099DAA4BDC4FE10\sketch\CommandStation-EX.ino.cpp:1:
C:\Users\XXXX\ex-installer\CommandStation-EX\mySetup.h: In function 'void setup()':
C:\Users\XXXXX\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino/WString.h:38:74: error: expected primary-expression before ')' token
#define F(string_literal) (reinterpret_cast<const __FlashStringHelper *>(PSTR(string_literal)))
^
C:\Users\XXXX\ex-installer\CommandStation-EX\CommandStation-EX.ino:120:43: note: in expansion of macro 'F'
#define SETUP(cmd) DCCEXParser::parse(F(cmd))
^
C:\Users\XXXX\ex-installer\CommandStation-EX\mySetup.h:3:1: note: in expansion of macro 'SETUP'
SETUP("<S 1000 40 1">);
^~~~~
I follow the instructions provided and I still get errors and all I want to do is really simple. It can't be this difficult I'm getting frustated. The instructions are all over the place with no real direction in a way I can understand. I have included the 3 files I have setup. Please just give me the reasons this doesn't work and what I'm doing wrong so I can learn without getting frustrated from links to this and that and don't help me.
In your second SETUP statement you have the greater sign after the quote. It should be SETUP("<S 1000 40 1>");
Sent by (dccextended@gmail.com). Created by fire.
Nathan created a ticket
Name: Nathan Clark
Email: clarnp49@gmail.com
Timezone: -5
Software: EX-CommandStation
Version: 4.0.x
Title: Input Sensors
Description: I am trying to figure out how to setup sensors on my CommandStation. I want to monitor a limit switch and then change the led color of my lights. I'm having a hard time understanding the whole sensor deal. I have tried ROUTE(1, "Test to Switch Lights") AT(42) SERVO(101, 450, Slow) AFTER(42) SERVO(101, 110, Slow) STOP DONE I have wires hooked up to GND, and 42. I upload the MyAutomation.h and hold the wires together on 42 and GND, nothing happens. IF I use the serial monitor and
and then touch the wires it displays the Q0 and q0 when I let them go. What am I doing wrong?Remaining email Quota: 100