Skip to content

Instantly share code, notes, and snippets.

@bjartwolf
Last active December 23, 2015 03:29
Show Gist options
  • Save bjartwolf/6573815 to your computer and use it in GitHub Desktop.
Save bjartwolf/6573815 to your computer and use it in GitHub Desktop.
Creating an acceleration meter channel
(def acc (chan (dropping-buffer 10)))
(let [accelerometer (.getDefault Windows.Devices.Sensors.Accelerometer)
minimumReportInterval (.-minimumReportInterval accelerometer)]
(set! accelerometer.-ReportInterval minimumReportInterval)
(.addEventListener accelerometer "readingchanged" (
fn [meter]
(put! acc (.toFixed (.-reading.accelerationX meter) 2)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment