Giter Club home page Giter Club logo

nodemcusimulator's Introduction

NodeMCU Simulator

Simple Simulator for the NodeMCU (ESP8266) hardware. This project is VERY early on, and is not nearly built out. It was started because I was tired of the test cycle of writing the Lua files to hardware and testing with actual hardware.

This project is built around LuaJ (http://www.luaj.org/luaj/3.0/README.html) with the NodeMCU API mocked out in Java, the best possible. Since the NodeMCU API's (http://nodemcu.readthedocs.org/en/dev/) are implemented in Java rather than hardware it will never be 100% correct, but this project aims to get close.

Please, if anyone is interested, help is definitely welcome to make this more complete. Some ideas is to implement more of the UI (at least ADC), and possibly extend it to have a System Out console, and maybe even Lua Debugger.

To run, simply build and execute the Main class. The simulation will automatically kick off the 'init.lua' file in the working directory. A sample blink program has been included.

The following API's have some / all work done:

Gpio

Keeps the pin states in memory, and allows for external interrupt / triggering. All functions are working except 'serout'.

Net

Just the beginnings of the net API is complete. It's just enough to create a simple client (No Server Yet).

Timer

Large portion of the important parts of the API are complete (alarm, register, unregister, start). Needs some work to be complete but works in separate Java threads, so no busy CPU.

Wifi

Dummy module for now, just retains state. Really just so I could run 'real' programs w/o it blowing up (Since a PC is often operating just as a STATION and already connected).

Json

Fully implemented version (in Lua). Easier to implement in lua (borrowed function), since there is no built in mechanism to Coerce a Lua Table to a Java Map.

MQTT

MQTT Functionality is fully implemented except for LWT. There is a sample that utilizes test.mosquitto.com to connect to. This is a free public test server that provides for simple testing. See sample init.lua for examples.

TODO: UI Implementation. Would be nice to have a list of messages sent / received for debugging purposes.

nodemcusimulator's People

Contributors

jcrygier avatar pvaass avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

nodemcusimulator's Issues

How do I use it?

Hi, any explanation how to use this project? I'm tired of manual testing with hardware, would be nice to write some automatic tests or at least run nodemcu apps without the hardware.

gradlew.build error

Hello i got the following error while building the gradlew build file can you please help me
FAILURE: Build failed with an exception
what went wrong:
Could not determine java version from "11.0.11".

This was my error previously but then I downloaded java SE jdk 8 or simply java 8 and then it worked fine
kindly tell me how to proceed for further process like led blinking

Thank you for making this :)

This might be a silly question, given that it's written in Java, but can I use Micropython on this simulator?

Compiling the simulator

Could you please write a more specific Readme.MD on how to compile and use the simulator. I've got a few years of Java experience but I am not able to compile this to a working Java program.

Error in compile

when I compile this project....
`
Exception in Application start method
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$155(LauncherImpl.java:182)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
at com.crygier.nodemcu.Main.start(Main.java:31)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
... 1 more
Exception running application com.crygier.nodemcu.Main

`
Please Help me.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.