Comments (3)
That behaviour is perfectly fine. What is happening is that the GET
message goes across the digiline and the RTC answers. The luacontroller receives that anwer. Every time the luacontroller receives an answer the code is executed again. In your case, that makes the luacontroller send the GET
signal again. Do you see where this leads? It creates an endless loop of the RTC responding and the luacontroller asking again.
Instead, you could use this code (tested with an RTC on channel "rtc"):
if (event.type ~= "digiline") then
digiline_send("rtc", "GET")
else
print("Time from RTC: " .. event.msg)
end
from digilines.
ok, thats i need - endless loop and it is normal in normal life like in PLC :) but i didnt expect burning of luacontroler here :) in normal world, you cant burn your cpu by this because you are limited by bus speed, cpu clock etc and communication libraries are mostly adjusted for this...
i trying to automate lighting of house in my minetest (before i have it with standart solar panel)
then it is not problem of digilines,but code is runing too fast when i just send get and read answer.
i tried it to send get, check digilines and set port of luacontr. - but it burned too and i didnt find any wait or delay function in lua lang. (but must admit that i forgot to make same with for)
but your code worked and after this i have periodic run:
(your code runs only once)
interrupt(1,"svetlo")
if (event.type ~= "digiline" ) then
digiline_send("sensor", "GET")
else
digiline_send("scrn1" , "light " .. event.msg .. " level")
end
thanks for help, and i must little learn about luacontroler :)
from digilines.
You don't want that either. The interrupt line will be executed on every trigger, so they will pile up. You only want one interrupt delay at a time. Look at the different event.type options.
from digilines.
Related Issues (20)
- lcd: letters are a bit far away
- LCD: Make the text left-aligned HOT 4
- Make digiline_chest report its contents on request HOT 16
- Add protected digiline_chest
- The display produces lots of warning messages like HOT 10
- minetest.setting_* functions are deprecated HOT 1
- LCD appears broken HOT 4
- LCD Z-fighting HOT 9
- LCD text is not visible from distance
- Vertical digilines HOT 2
- Add Support for Tubelib and/or Terumet to the Digilines Chest HOT 1
- LCD line length limits are not enforced properly HOT 2
- LCD lines and character limits HOT 4
- Clear screen HOT 1
- German "Umlaute" are ignored when cut and paste text in a Microcontroller editor HOT 2
- Documentation is missing HOT 2
- Get contents of a digiline chest? HOT 1
- Digiline distributor not working in the game
- moves stuff in chest at
- *hard* depends on default or mcl, not optionally HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from digilines.