Search found 6 matches

by KiDeKi
Tue Sep 29, 2020 09:51
Forum: General Discussion
Topic: LUACONTROLLER UNDERSTANDING
Replies: 9
Views: 375

Re: LUACONTROLLER UNDERSTANDING

It's because your code relies on that there are no incoming events, only program and interrupt. Turning on or off the other ports sends the luacontroller more interrupts so the code is being run more times. To avoid this, you need to check if the code was triggered by the event you expected. For ex...
by KiDeKi
Sun Sep 27, 2020 19:20
Forum: General Discussion
Topic: LUACONTROLLER UNDERSTANDING
Replies: 9
Views: 375

Re: LUACONTROLLER UNDERSTANDING

I have come to the similar problem in chapter IV "Code a timer that toggles port A every two seconds." My solution is: interrupt (2) port.a = not pin.a Now - it works, toggles port A every two seconds - until I turn on any other switch on any other port B,C or D - then it starts to blink u...
by KiDeKi
Sun Sep 27, 2020 18:32
Forum: General Discussion
Topic: LUACONTROLLER UNDERSTANDING
Replies: 9
Views: 375

Re: LUACONTROLLER UNDERSTANDING

pin and port are two separate variables. When the code starts, the variable pin is filled by the current state of input. At the end of the script, the mesecon signals are turned on or off according to the port variable. The variables pin and port aren't being synchronised throughout the execution u...
by KiDeKi
Sun Sep 27, 2020 12:08
Forum: General Discussion
Topic: LUACONTROLLER UNDERSTANDING
Replies: 9
Views: 375

Re: LUACONTROLLER UNDERSTANDING

It's because at first event, port.a becomes true but pin.a is false so port.b will be also false. On the second run, pin.a becomes true because the mesecon at side A is powered by the luacontroller. So port.b becomes true which activates port B. Thank you Hume2 for the explanation. What I do not un...
by KiDeKi
Sat Sep 26, 2020 23:23
Forum: General Discussion
Topic: LUACONTROLLER UNDERSTANDING
Replies: 9
Views: 375

Re: LUACONTROLLER UNDERSTANDING

Read the chapter 5 to see what is understood as an event. Does it answer your question? Yes, thank you. I have used print( event ) to see what's going on. Its clear now. Thank you. What is still unclear is that - why on a second event, this code (port.a = true port.b = pin.a) will activate port B ?
by KiDeKi
Sat Sep 26, 2020 12:52
Forum: General Discussion
Topic: LUACONTROLLER UNDERSTANDING
Replies: 9
Views: 375

LUACONTROLLER UNDERSTANDING

Hi all, I'm following this tutorial for luacontroller and some things are just not clear to me. Maybe I do not understand some electronics concepts or how microcontroller works Can you help me understand it? Question is: (from this page: http://mesecons.net/items.html ... You can easily establish a ...