FogLight is a lightweight runtime that enables makers of all ages and skill levels to create highly performant apps for embedded devices like Raspberry Pis.
FogLight is a Java 8 functional API for embedded systems that's built on top of GreenLightning, a small footprint, garbage free compact 1 Java web server and message routing platform,
FogLight is...
- Fast - Built on top of GreenLightning, FogLight is a garbage-free, lock-free and low latency way to talk directly to hardware.
- Simple - Taking advantage of the latest Java 8 APIs, FogLight has a clean and fluent set of APIs that make it easy to learn and apply with minimal training.
- Secure - By taking advantage of the compile-time graph validation system, all FogLight applications can be compiled and compressed to a point where injecting malicious code into the final production JAR would prove difficult, if not impossible.
Every FogLight application starts with an FogApp
implementation which initializes the FogRuntime
by defining various hardware connections and behaviors for handling state changes in those connections.
A very simple example of a FogLight application is below (omitting boilerplate import statements and so on); this app makes an LED connected to a GrovePi board blink every 500 milliseconds:
public class IoTApp implements FogApp {
private static final int PAUSE = 500;
public static final Port LED_PORT = D5;
public static void main( String[] args) {
FogRuntime.run(new IoTApp());
}
@Override
public void declareConnections(Hardware c) {
c.connect(LED, LED_PORT);
c.setTriggerRate(PAUSE*2);
}
@Override
public void declareBehavior(FogRuntime runtime) {
final FogCommandChannel blinkerChannel = runtime.newCommandChannel();
runtime.addTimeListener((time,instance)->{
blinkerChannel.setValueAndBlock(LED_PORT, true, PAUSE);
blinkerChannel.setValue(LED_PORT, false);
});
}
}
Of course, this is just a simple example; for more interesting examples that demonstrate the various features currently available in FogLight, you should take a look at our examples repository.
- Analog TollC
- Angle Sensor
- Button
- Buzzer
- Four Digit Display
- GPS
- wiki
- demo - Coming Soon!
- I2C Mini Motor Driver
- I2C Motor Driver
- LCD RGB Backlight
- LED
- Light Sensor
- Line Finder
- MP3Player
- wiki
- demo - Coming Soon!
- Moisture Sensor
- Motion Sensor
- OLED 128x64
- OLED 96x96
- Real Time Clock
- Relay
- SixAxisAccelerometer
- Temperature Sensor
- Three Axis Acceleromter
- Thumb Joystick
- Touch Sensor
- UV Sensor
- Ultrasonic Rangefinder
- Variable Color LED
- Vibration Sensor
- Water Sensor