Page 1 of 1

Connecting to Wifi with Program / LMSASM tool tutorial

Posted: 21 Dec 2013, 19:11
by devirex
Hello,

i found out how to connect your EV3 to a Wifi with a program from the standard Lego VM without clicking trough the menu.

1. create a lms script (f.e. C:\myapps\wifi.lms) and replace <SSID> and <PASSKEY>:

Code: Select all

define    HARDWARE        HW_WIFI 
DATA8	On
DATA32  Timer

vmthread  MAIN {

XOR8(1,On,On)
COM_SET(SET_ON_OFF,HARDWARE,On)
TIMER_WAIT(12000,Timer)
TIMER_READY(Timer)
COM_SET(SET_SSID,HARDWARE,'<SSID>')
COM_SET(SET_ENCRYPT,HARDWARE,'<SSID>',ENCRYPT_WPA2)
COM_SET(SET_PIN,HARDWARE,'<SSID>','<PASSKEY>')
COM_SET(SET_CONNECTION,HARDWARE,'<SSID>',1)
}


2. Use LMSASM tool to compile the lms code to rbf. If you already know how to use the LMSASM tool continue with 6.

3. Get ev3sources from https://github.com/mindboards/ev3sources

4. Copy files bytecodes.h and bytecodes.c from "ev3sources\lms2012\lms2012\source" to "ev3sources\lms2012\lmssrc\adk\lmsasm"
Open a shell and change directory to "ev3sources\lms2012\lmssrc\adk\lmsasm"


5. Run Command:
java -jar assembler.jar "<Path to lms file>\<File name without extension>"

f.e. on a Windows Host with file "C:\myapps\wifi.lms"
java -jar assembler.jar "C:\myapps\wifi"


6. Upload wifi.rbf, which will be created in the same path as the wifi.lms, to your ev3 or copy it in the myapps folder of your EV3 SD Card.

7. Enjoy connecting to your wifi by one click.

Regards