Posts

Dartino - Getting Started

Image
How small a device can run Dart? Raspberry Pi may be physically small and the Raspberry Pi Zero even smaller, but the Pi is a full microprocessor and runs a full Linux or Windows stack. What about microcontrollers? Running on the bare metal with limited resources?
Enter Dartino. I've been playing around with the little brother of Dart named Dartino. It's targeted at microcontrollers with limited resources. Small devices with a single purpose. Thermostat. Hydroponics monitor. Weather station. While it's really great having all the capabilities of a full OS stack on the RPI, there's something really cool about plugging in a microcontroller based device and having the application running in under a second. Small. Dedicated devices. Fewer things to fail.
I started playing around with Dartino and it is still definitely in its infancy, but it recently crossed a milestone when I found I could create simple interactive apps. With the 0.4.0 release of the Dartino SDK, I built…

Dart on Pi - Updated rpi_gpio to 0.2.2

I've published version 0.2.2 of the rpi_gpio package which provides, among other things, belated support for Raspberry Pi version 2. All of my personal Pi computers in service to date have been pre-v2.

Dart on Pi - Update

Two separate items this week:

I built Dart SDK 1.11.1 stable for the Raspberry Pi, and you can download it here version 1.11 : rpi-dart-sdk-1.11.1-stable.0.0.zip
In addition, I've been testing the rpi_gpio package interrupt support as part of my personal projects and it seems stable enough that I've published version 0.2.

Dart on Pi - Tracking Changes

Tracking Raspberry Pi GPIO values One application of the RPi is to track sensor changes over time. For example, a RPi could have various sensors for detecting water in places on the floor. The Dart program running on the RPi could detect the sensor change and send an email (see mailer pub package for sending email using Dart) reporting the problem. We can read the GPIO pin values as discussed in the previous post, but how to track them over time? Two possibilities include:
Polling Interrupts
Polling Using the rpi_gpio pub package mentioned in the previous post, one approach for detecting a sensor change is to periodically check the value and compare it with the previous value. If the value has changed since the last time it was read, then we can react to that change. To start, create a sensor class for tracking the value of a GPIO pin. Periodically call the sensor's hasChanged method to determine if the pin has changed state.
class Sensor {  final Pin pin;  int value;
 Sensor(this.pin) …