Read Output pin state
-
@wayneosdias
Either you are not actually reading any of the responses given, or there is some sort of communication or translation issue.You have been told several times that the Gcode is
state.gpOut[3].value
where 3 is the sensor number of an output pin.
or
sensors.gpIn[3].value
where 3 is the sensor number of an input pin
If your sensor is connected to the duet, then it is an INPUT
Your Gcode needs to contain something like
while sensors.gpIn[3].value = 1 G4 P500 ; if the sensor level is high, go into a wait loop
You are unlikely to get working code unless you find someone who also uses openPNP, but you have been provided ample information to work it out.r
-
@wayneosdias said in Read Output pin state:
I tried this
state.gpOut[3].value Error: Bad command: stategpOut[3]value ok
Try this:
echo state.gpOut[3].value
-
@dc42 said in Read Output pin state:
echo state.gpOut[3].value
Hey dc
I tried but still get...> echo state.gpOut[3].value Error: Bad command: echostategpOut[3]value ok
-
@owend
I have read and tried all responses thoroughly before each and every response. I think you may be having difficulty understanding the question. But it's stated pretty explicitly. -
@wayneosdias If you want the pwm value, use state.gpOut[3].pwm. You can't get undefined items.
-
@stephen6309 said in Read Output pin state:
state.gpOut[3].pwm
Thanks Stephen,
I cant get that to work either> echo state.gpOut[3].pwm Error: Bad command: echostategpOut[3]pwm ok > state.gpOut[3].pwm Error: Bad command: stategpOut[3]pwm ok > M118 P1 S{state.gpOut[3].pwm} L0 Error: M118: unknown value 'stategpOut^pwm' ok
-
@wayneosdias I don't have any gpio pins defined, but 0 is there.
Currently on rrf 3.4.0rc2
Sending in the DWC Console:
echo state.gpOut[0].pwmThis shows up in the DWC Console:
echo state.gpOut[0].pwm
0.0736Object Model in DWC shows 0.07
-
@wayneosdias What program are you using to send those commands? It looks like something is removing some of the characters before they are sent to the Duet.
-
@stephen6309 Hey Stephen
I need response via USB to Openpnp. DWC is connected via ethernet -
@gloomyandy
Hey Andy its Openpnp -
@wayneosdias Then you need to determine why it's removing spaces and periods from the command.
-
@stephen6309
I think you got it. When I view the trace logs of the comms between Openpnp and the hardware, all commands sent from Openpnp the spaces are trimmed...
Ill dtry again and post a log snippet. -
Openpnp Gcode console...
> M118 P1 S{state.gpOut[3].pwm} L0 Error: M118: unknown value 'stategpOut^pwm' ok
Openpnp Trace log...
2022-02-27 10:42:30.123 GcodeAsyncDriver DEBUG: serial://COM13 commandQueue.offer(M118 P1 S{state.gpOut[3].pwm} L0, 5000)... 2022-02-27 10:42:30.124 GcodeAsyncDriver$WriterThread TRACE: [serial://COM13] >> M118P1S{stategpOut[3]pwm}L0 2022-02-27 10:42:30.126 GcodeDriver$ReaderThread TRACE: [serial://COM13] << Error: M118: unknown value 'stategpOut^pwm' 2022-02-27 10:42:30.126 GcodeDriver$ReaderThread TRACE: [serial://COM13] << ok
spaces are being trimmed. I guess I need to take this to the Openpnp guys.
Thanks for everyones help
-
@stephen6309
I just confirmed in Realterm a basic serial interfaceM118 P1 S{state.gpOut[3].pwm} L0 [\n]
Works and responds
0.30 ok
But not in Openpnp 2nd trimming spaces. I'm not sure why RRF hiccups on this as the following works fine;
2022-02-27 11:21:16.287 ReferenceActuator DEBUG: DragPin PulseOn.actuate(false) 2022-02-27 11:21:16.287 GcodeAsyncDriver DEBUG: serial://COM13 commandQueue.offer(M42 P3 S0, 5000)... 2022-02-27 11:21:16.287 GcodeAsyncDriver DEBUG: serial://COM13 commandQueue.offer(G4 P100, 5000)... 2022-02-27 11:21:16.287 GcodeAsyncDriver$WriterThread TRACE: [serial://COM13] >> M42P3S0 2022-02-27 11:21:16.288 GcodeAsyncDriver$WriterThread TRACE: [serial://COM13] >> G4P100 2022-02-27 11:21:16.288 GcodeDriver$ReaderThread TRACE: [serial://COM13] << ok 2022-02-27 11:21:16.388 GcodeDriver$ReaderThread TRACE: [serial://COM13] << ok
Again spaces trimmed but RRF processes it just fine. Is there a setting within RRF to accept this or will this be an Openpnp work around?
-
@wayneosdias It's not just spaces being removed, it has also dropped the "." in "[3].pwm"
-
@gloomyandy
You're right.
Just for giggles I tried this;2022-02-27 11:32:30.996 GcodeAsyncDriver DEBUG: serial://COM13 commandQueue.offer("M118 P1 S{state,gpOut[3],pwm"} L0, 5000)... 2022-02-27 11:32:30.996 GcodeAsyncDriver$WriterThread TRACE: [serial://COM13] >> "M118P1S{state,gpOut[3],pwm"}L0 2022-02-27 11:32:30.998 GcodeDriver$ReaderThread TRACE: [serial://COM13] << Error: Bad command: "M118P1S{state,gpOut[3],pwm"}L0 2022-02-27 11:32:30.998 GcodeDriver$ReaderThread TRACE: [serial://COM13] << ok
It trims'.' and spaces, but not commas. I'll ask the Openpnp guys about it...
-
@gloomyandy @Stephen6309
I have to turn off gcode compression within Openpnp and everything works. I dunno what kind of a performance hit Ill have if any. I believe the Full 3rd order motion planner is pretty comm intensive. Thanks for the help guys.
-
You can check the "Backslash Escaped Characters?" box and by-hand enter all the characters that got compressed into the string if you want to.
That way you can still run compressed.
-
@alankilian
Yes! Thanks Alan!M118 P1 S{state\u002EgpOut[3]\u002Epwm} L0
Works perfectly with GCode Compression
2022-02-27 13:07:50.156 GcodeAsyncDriver DEBUG: serial://COM13 commandQueue.offer(M118 P1 S{state\u002EgpOut[3]\u002Epwm} L0, 5000)... 2022-02-27 13:07:50.158 GcodeAsyncDriver$WriterThread TRACE: [serial://COM13] >> M118 P1 S{state.gpOut[3].pwm} L0 2022-02-27 13:07:50.158 GcodeDriver$ReaderThread TRACE: [serial://COM13] << 0.00 2022-02-27 13:07:50.159 GcodeDriver$ReaderThread TRACE: [serial://COM13] << ok
Thanks Again Alan!
-
I'm thrilled that you are taking the time to work Duet into the OpenPNP world.
Are you sure you turned compression back on?
Because I thought it compressed the spaces out also but it doesn't seem to be doing that.