Post your best Lua script examples here

User avatar
By spy king
#9836 Heya, am new to Lua.

Is there a basic "blinky" script somewhere to get me started?

I have connected a led via GPIO02 (+Ve and -Ve to ground) But I can't get it to change it's value using LuaLoaders gpio.write(4,gpio.LOW) command.

Am I missing something?


EDIT: Yes, I didn't click the set button :)
Regards
User avatar
By spy king
#9843 So after playing around a bit, I have managed to get a webserver running, and a couple of buttons to toggle the GPIO.

What would the simplest way of controlling this pin through a simple mobile app be?

I am guessing that a html webserver isn't the best option? Can someone point me in the right direction?

Regards
User avatar
By cendev
#9857 the simpliest method i can think of is apache cordova + tlantic socket library :) you can use your web programming / designing skills to create a nice looking / less time consuming app :) tlantic library lets to use tcp protocol and makes it simple as "if you can program for web / you can program for mobile" :)

personally i do not prefer using webpage type management options for gpio's, a simple tcp server looks kinda less work for esp :)
User avatar
By dpwhittaker
#9869 If you're on Android, a few simpler alternatives come to mind:

Tasker - build the interface graphically on the phone, use an HTTP Post "task" to do stuff
DroidScript - write the gui and the http calls in javascript

Both are simpler than learning the android sdk to create a simple app, and both can create apks.

If you're on iPhone, can't help you there.