You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mesecons wires act like wired-OR systems when there are multiple drivers (“receptors”) attached to a single wire—the wire is powered if any of the levers/buttons/etc. connected to it are active.
In the Luacontroller world, using a pin exclusively as an output works fine (with the port table), and using it exclusively as an input also works fine (with the pin table). But multiple-driver configurations do not work properly. For example, build a wire connected to a lever and a Luacontroller I/O pin, then do the following sequence of steps:
Set the port value high (port.a = true).
Flip the lever to the ON state.
Set the port value low (port.a = false).
Print the pin value (print(pin.a)).
The value printed is false, despite the lever being on! Even changing the state of other inputs does not have any effect—the input only reads as high once the lever is turned off and on again.
This is not just about events not firing. In fact, even if an event is provoked by some other cause (such as a program event, or even another input pin!), the pin table still shows false for the active input.
The text was updated successfully, but these errors were encountered:
I know that not generating change events when outputs change is intentional (there’s a bunch of code to squelch those), but even having the pin array read totally wrong values? That seems weird—on any real-world microcontroller I’ve used, you can still read a pin as input when it’s operating in any kind of output mode for which reading input makes sense (e.g. open-drain mode) and get back an accurate value.
Mesecons wires act like wired-OR systems when there are multiple drivers (“receptors”) attached to a single wire—the wire is powered if any of the levers/buttons/etc. connected to it are active.
In the Luacontroller world, using a pin exclusively as an output works fine (with the
port
table), and using it exclusively as an input also works fine (with thepin
table). But multiple-driver configurations do not work properly. For example, build a wire connected to a lever and a Luacontroller I/O pin, then do the following sequence of steps:port.a = true
).port.a = false
).print(pin.a)
).The value printed is false, despite the lever being on! Even changing the state of other inputs does not have any effect—the input only reads as high once the lever is turned off and on again.
This is not just about events not firing. In fact, even if an event is provoked by some other cause (such as a
program
event, or even another input pin!), thepin
table still shows false for the active input.The text was updated successfully, but these errors were encountered: