Giter Club home page Giter Club logo

embedded-framework's Introduction

Java Embedded Framework

Java embedded framework for create sensors drivers via i2c bus

With this framework you can develop your own libraries on Java, Groovy or any JVM language

This framework allow you to easy change and use any IO provider

under development this code work, but be refactored

You need first https://github.com/452/java-i2c-tools

How to build and use

Build

./gradlew publishMavenJavaPublicationToMavenLocal

add to your pom.xml

<dependency>
    <groupId>com.github.452</groupId>
    <artifactId>embedded-framework</artifactId>
    <version>0.0.1</version>
</dependency>

Groovy:

// grape uninstall "com.github.452" "java-i2c-tools" "0.0.1"
// grape uninstall "com.github.452" "embedded-framework" "0.0.1"
@Grab(group='com.github.452', module='java-i2c-tools', version='0.0.1')
@Grab(group='com.github.452', module='embedded-framework', version='0.0.1')
import ua.kovel.java.i2c.tools.*;
import ua.kovel.java.i2c.devices.*;
import ua.kovel.java.i2c.devices.LcdPcf8574.Config;

I2C i2c = new I2C("i2c-tiny-usb", LcdPcf8574.ADDRESS);
Config config = new Config() {

    @Override
    public void write(byte[] data, int command) throws IOException {
        for (int position = 0; position < data.length; position++) {
            i2c.writeByte(command, data[position] & 0xFF);
        }
    }
};

LcdPcf8574 lcd = new LcdPcf8574(config);

lcd.begin(16, 2);
lcd.setBacklight(true);
lcd.home();
lcd.clear();
lcd.print("Hello Groovy LCD 1602");
sleep(1000)
while(1) {
    def now = new Date()
    utc = now.format("HH:mm:ss", TimeZone.getTimeZone('UTC'))
    us = now.format("HH:mm:ss", TimeZone.getTimeZone('US/Eastern'))
    lcd.setCursor(0, 0);
    lcd.print("UTC $utc")
    lcd.setCursor(0, 1);
    lcd.print("US  $us")
    sleep(1000)
}

Usage example

BME280 example

embedded-framework's People

Contributors

452 avatar natalia-lavr avatar

Watchers

 avatar  avatar

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.