Skip to content

Instantly share code, notes, and snippets.

@beerriot
beerriot / altimeter-reading.lua
Created Feb 20, 2017
Beer IoT (Part 4) example code: Altimeter Reading
View altimeter-reading.lua
addr = 0x53 -- Default I2C address
reg_pwr_ctl = 0x2D -- Power control register
pwr_ctl_on = 0x08 -- Active measurement mode
reg_x0 = 0x32 -- X0 register
length = 6 -- Bytes for a full measurement
-- Power up
he.set_power(true)
-- ADXL345 starts in an idle mode; activate it
@beerriot
beerriot / altimeter-posting.lua
Created Feb 20, 2017
Beer IoT (Part 4) example code: Altimeter Posting
View altimeter-posting.lua
now = he.now() -- time that we took the reading
-- "f" is "floating point type
-- port, time, type, value
he.send("x", now, "f", x)
he.send("y", now, "f", y)
he.send("z", now, "f", z)
View 2021-late-jan-early-feb.csv
YYYY-MM-DD-HHMM_US_CENTRAL samples total_ping_drop count_full_ping_drop count_obstructed total_obstructed_ping_drop count_full_obstructed_ping_drop count_unscheduled total_unscheduled_ping_drop count_full_unscheduled_ping_drop init_run_fragment final_run_fragment run_seconds_1 run_seconds_2 run_seconds_3 run_seconds_4 run_seconds_5 run_seconds_6 run_seconds_7 run_seconds_8 run_seconds_9 run_seconds_10 run_seconds_11 run_seconds_12 run_seconds_13 run_seconds_14 run_seconds_15 run_seconds_16 run_seconds_17 run_seconds_18 run_seconds_19 run_seconds_20 run_seconds_21 run_seconds_22 run_seconds_23 run_seconds_24 run_seconds_25 run_seconds_26 run_seconds_27 run_seconds_28 run_seconds_29 run_seconds_30 run_seconds_31 run_seconds_32 run_seconds_33 run_seconds_34 run_seconds_35 run_seconds_36 run_seconds_37 run_seconds_38 run_seconds_39 run_seconds_40 run_seconds_41 run_seconds_42 run_seconds_43 run_seconds_44 run_seconds_45 run_seconds_46 run_seconds_47 run_seconds_48 run_seconds_49 run_seconds_50 run_seconds_51 run_