mattjlewis / diozero

Java Device I/O library that is portable across Single Board Computers and microcontrollers. Tested with Raspberry Pi, Odroid C2, BeagleBone Black, Next Thing CHIP, Asus Tinker Board and Arduinos / Pico. Supports GPIO, I2C, SPI as well as Serial communication. Also known to work with Udoo Quad.
https://www.diozero.com
MIT License
261 stars 59 forks source link

Add example for ESP over Wifi and Arduino/ESP over serial #96

Open egeu5 opened 2 years ago

egeu5 commented 2 years ago

Hello, I'm planning to use you're awesome project to teach kids in java. In my opinion this is a nice way to intruduct into object orientated programming - I like "physical" objects. I did not found any examples for ESP8266 over wifi or serial (or Arduino over serial). Is there any guide and I just did not found it? If not, please help me and I will add (after getting it working) a tutorial in you're docs.

Thank you! Chris

mattjlewis commented 2 years ago

Hi Chris, very glad you find it useful.

I'd recommend you start with the Firmata section within the Remote Control page, apologies if this isn't obvious. Happy to provide further guidance if this still doesn't work - also any suggestions or updates to documentation would be greatly appreciated.

Regards, Matt

egeu5 commented 2 years ago

Hi @mattjlewis , sorry for the late answear, I missed you're reply... I already uploaded the firmata firmware on an arduino an tried it with another Java Lib and I could turn on and off a LED. But I have no idea how to start on you're lib.

mattjlewis commented 2 years ago

Easy if you are using Maven, as per the docs:

mvn archetype:generate -DarchetypeGroupId=com.diozero -DarchetypeArtifactId=diozero-application -DarchetypeVersion=1.3.3 -DgroupId=com.mycompany -DartifactId=mydiozeroapp -Dversion=1.0-SNAPSHOT

Then add this to the dependencies section in the created pom.xml:

        <dependency>
            <groupId>com.diozero</groupId>
            <artifactId>diozero-provider-firmata</artifactId>
            <version>1.3.3</version>
        </dependency>

The archetype creates a sample Java app that toggles an LED. Run this with app with the command line flag -Ddiozero.firmata.serialPort as per the Firmata instructions.

jflamy commented 1 year ago

FirmataBuilder does not provide an ESP32 WiFi configuration. Can anyone provide me with pointers on a working configuration ?

Ideally my devices would be DHCP-ed and the firmata would know the server hostname. I can also do the opposite and locate the DHCP addresses allocated to my ESP32s.