Corona and Arduino

Hi everyone,

just started this topic to understand if and how corona can comunicate with esternal hardware like arduino and if it’s possible to build an app which can make up to two devices to comunicate each other via bluetooth and play in multiplayer on the same game.

Thanks in advice =)

Corona SDK has TCP/IP networking built in, which means it can talk to an Ardunio/Raspberry Pi type board using WiFi. There is an Android only plugin in the marketplace that supports Bluetooth BLE on Android 4.3 and higher that you can use to communicate.

Rob

So can’t I make my iPhone comunicate with Arduino?

Via WiFi if the board supports it. There is a great community created tool called AutoLAN. The company that made it isn’t supporting it, but some community members updated it for IPv6 support. You can search the forums for that.

But beyond WiFi/TCP/IPt, Corona SDK has no features to talk to an Ardunio from iOS. You could purchase Corona Enterprise and build your own native drivers to communicate over bluetooth and bridge it to Lua/Corona code.

Rob

Hi Rob, 

I’ve had a go at trying out the BLE Android plugin and I successfully managed to connect to the HM10 BLE module that I am using for my Arduino project. However, due to the fact that I am very inexperienced in app development and BLE, I can’t quite figure out how to send characters such as ON/OFF from the Corona app. I am attempting to simply turn an LED on/off using the app. 

Please, any advise would be really helpful in that regard. 

Thanks!

Just to make my previous post clearer, I have created a new button in the example BLE app provided by Lerg dedicated for turning an LED on. My Arduino has been programmed to accept a non zero serial value to turn the LED on or a zero value to turn the LED off. I have tested this with a pre-built Evothings app and it works fine. 

I just have no idea of how to enable the example BLE app to send a value of 1 or 0 to the HM10 ble module that I using for my project. 

Here is the code for the button, not sure what to add to the onRelease section: 

local ledOn = widget.newButton

    { width = 250,

      height = 40,

      defaultFile = “buttonbackground.png”,

      overFile = “buttonbackground1.png”,

      shape = “roundedRect”,

      labelColor = { default={ 0, 0, 0 }, over={ 0, 0, 0 } },

      font = native.systemFontBold,

      fillColor = { default={ 1, 1, 1, 1 }, over={ 0.65, 0.65, 0.65, 1 } },

        label = ‘LED ON’,

        – onRelease 

        NEED HELP WITH THIS SECTION TO ALLOW FOR 1 TO BE SENT OVER THE BLE CONNECTION, PLEASE.      

      }

        ledOn.x = display.contentCenterX

        ledOn.y = display.contentHeight- 20

Corona SDK has TCP/IP networking built in, which means it can talk to an Ardunio/Raspberry Pi type board using WiFi. There is an Android only plugin in the marketplace that supports Bluetooth BLE on Android 4.3 and higher that you can use to communicate.

Rob

So can’t I make my iPhone comunicate with Arduino?

Via WiFi if the board supports it. There is a great community created tool called AutoLAN. The company that made it isn’t supporting it, but some community members updated it for IPv6 support. You can search the forums for that.

But beyond WiFi/TCP/IPt, Corona SDK has no features to talk to an Ardunio from iOS. You could purchase Corona Enterprise and build your own native drivers to communicate over bluetooth and bridge it to Lua/Corona code.

Rob

Hi Rob, 

I’ve had a go at trying out the BLE Android plugin and I successfully managed to connect to the HM10 BLE module that I am using for my Arduino project. However, due to the fact that I am very inexperienced in app development and BLE, I can’t quite figure out how to send characters such as ON/OFF from the Corona app. I am attempting to simply turn an LED on/off using the app. 

Please, any advise would be really helpful in that regard. 

Thanks!

Just to make my previous post clearer, I have created a new button in the example BLE app provided by Lerg dedicated for turning an LED on. My Arduino has been programmed to accept a non zero serial value to turn the LED on or a zero value to turn the LED off. I have tested this with a pre-built Evothings app and it works fine. 

I just have no idea of how to enable the example BLE app to send a value of 1 or 0 to the HM10 ble module that I using for my project. 

Here is the code for the button, not sure what to add to the onRelease section: 

local ledOn = widget.newButton

    { width = 250,

      height = 40,

      defaultFile = “buttonbackground.png”,

      overFile = “buttonbackground1.png”,

      shape = “roundedRect”,

      labelColor = { default={ 0, 0, 0 }, over={ 0, 0, 0 } },

      font = native.systemFontBold,

      fillColor = { default={ 1, 1, 1, 1 }, over={ 0.65, 0.65, 0.65, 1 } },

        label = ‘LED ON’,

        – onRelease 

        NEED HELP WITH THIS SECTION TO ALLOW FOR 1 TO BE SENT OVER THE BLE CONNECTION, PLEASE.      

      }

        ledOn.x = display.contentCenterX

        ledOn.y = display.contentHeight- 20