Skip to content
This repository has been archived by the owner on Aug 5, 2022. It is now read-only.

ZJS Hackathon

Sakari Poussa edited this page May 19, 2017 · 4 revisions

Welcome to the ZJS Hackathon (May 2017)!

We suggest you begin by working through one or more of the following exercises. See below for resources that can help you.

Preparing your development environment

Your Arduino 101 has been preloaded with a ZJS "ide" image. This provides a default set of APIs (namely AIO, Buffer, Console, Events, Filesystem, GPIO, Grove LCD, I2C, PME, PWM, Sensor, and Timers).

See ashell connect instructions to add udev rules on Linux or install drivers on Windows (Mac shouldn't need anything special).

Consult the rest of the ashell instructions for more information.

Connecting the WebIDE to your device

Plug your Arduino 101 into your PC with the USB calbe. About seven seconds after you give it power, the bootloader will time out and the device will start advertising itself as a WebUSB device. If you have Chrome open on Linux or Mac, it will display a notification that a WebUSB device has been found. If you click on the notification, it will open the WebIDE URL. (On Windows, this notification doesn't work. You will need to manually go to https://01org.github.io/zephyrjs-ide.)

Click the "Let's get started" button and then click Connect near the top left. Choose your device from the list and after a few seconds you should see some help commands appear in the Console pane (lower right). Now you're ready to edit code and click Run (top right of code pane) to push the code to the device and run it. This takes about two seconds. Eventually your device will probably get wedged for one reason or another. Just click the blue Master Reset button, wait seven seconds and reconnect from the IDE. (Just dismiss the WebUSB notification if you get one.)

Exercises

1. Button + LED

Create an application that blinks an LED but only when a button is being pressed. You'll need to use a Grove Button connected to a GPIO pin and can either use an onboard LED (LED0 or LED1) or wire up a Grove LED etc.

2. Potentiometer + LED

Hook up a Grove potentiometer "Rotary Angle Sensor" to an analog input pin, and an LED to a PWM output pin (3, 5, 6, or 9) to control its brightness. Write an application to regularly read the analog input and change the pulse width (and therefore duty cycle) of the PWM output.

What happens if you hook up a Grove Buzzer (aka annoy-o-tron) instead?

3. Sensor + LED/Buzzer

Read the A101's accelerometer values and turn on an alert LED for 5s or Buzzer for 1s when the number of G's goes over a threshold like 3 G's. (Note: Gravity at the hackathon location is roughly 9.80663 m/s^2.)

4. BLE + Buttons

If you have a BLE-capable Android phone or an iPhone, download an app such as nRF Connect that can talk to BLE devices.

Create an application that reports button status over a BLE connection. You can start with reading, then try updating via notifications.

Looking at a sample like WebBluetoothGroveLcdDemo should help. (There are simpler ones in there too.)

Resources

See the Examples button on the left side of the WebIDE.

ZJS API Documentation

ZJS Sample Applications