ESP8266 NodeMCU Running Out of Heap Memory

There was a problem in the NodeMCU docs with the socket:send example you seem to have based your implementation on. We discussed it and I fixed it. An improved version of your code is this: gpio.mode(3, gpio.OUTPUT) srv = net.createServer(net.TCP, 28800) print(“Server created… \n”) local pinState = 0 srv:listen(80, function(conn) conn:on(“receive”, function(sck, request) local _, … Read more

Lua math.random not working

You need to run math.randomseed() once before using math.random(), like this: math.randomseed(os.time()) One possible problem is that the first number may not be so “randomized” in some platforms. So a better solution is to pop some random number before using them for real: math.randomseed(os.time()) math.random(); math.random(); math.random() Reference: Lua Math Library

Call a function by an external application without opening a new instance of Matlab

Based on the not-working, but well thought, idea of @Ilya Kobelevskiy here the final workaround: function pipeConnection(numIterations,inputFile) for i=1:numIterations while(exist(‘inputfile’,’file’)) load inputfile; % read inputfile -> inputdata output = myFunction(inputdata); delete(‘inputfile’); end % Write output to file % Call external application to process output data % generate new inputfile end; Another convenient solution would be … Read more

Generating uniform random numbers in Lua

You need to run math.randomseed() once before using math.random(), like this: math.randomseed(os.time()) From your comment that you saw the first number is still the same. This is caused by the implementation of random generator in some platforms. The solution is to pop some random numbers before using them for real: math.randomseed(os.time()) math.random(); math.random(); math.random() Note … Read more