Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I found what I needed here: <a href="http://www.armhf.com/index.php/using-beaglebone-black-gpios/" rel="nofollow noreferrer">http://www.armhf.com/index.php/using-beaglebone-black-gpios/</a>.</p> <p>I'm running kernel 3.8.13.</p> <p>Based on that, I wrote this script:</p> <pre><code>#!/bin/bash # http://www.armhf.com/index.php/using-beaglebone-black-gpios/ # pin 9:11, gpio0[30] - 0 + 30 = 30 echo 30 &gt; /sys/class/gpio/export echo in &gt; /sys/class/gpio/gpio30/direction cat /sys/class/gpio/gpio30/value # 1=switch open; 0=switch closed while [ 1 ] ; do cat /sys/class/gpio/gpio30/value ; sleep .5 ; done </code></pre> <p>When the pin is held low, the script displays 0, and 1 when high. I breadboarded a circuit based on <a href="http://www.digikey.com/us/en/techzone/microcontroller/resources/articles/protecting-inputs-in-digital-electronics.html" rel="nofollow noreferrer">http://www.digikey.com/us/en/techzone/microcontroller/resources/articles/protecting-inputs-in-digital-electronics.html</a>.</p> <p>The orange wires on the right side of the pic act as a switch.</p> <p>My plan is to then take this and a door switch from a dead printer to make a freezer switch. Then I'll modify the script to email me when the freezer's been open for more than say, 10 minutes.</p> <p><img src="https://i.stack.imgur.com/SpdOu.jpg" alt="enter image description here"></p> <p>Edit:</p> <p>Did some study and found more info on how to set pinmux, specifically with device tree overlays:</p> <p>Okay, watched this, and learned a lot: <a href="http://www.youtube.com/watch?v=wui_wU1AeQc" rel="nofollow noreferrer">http://www.youtube.com/watch?v=wui_wU1AeQc</a></p> <p>Was able to finally get control over pinmux settings on the BBB with the device tree overlay below. The fragment@1 section is still magic to me, so at some point hopefully it'll make more sense. Nevertheless, at least I can detect closed switches on all for pins.</p> <p>One critical piece was the chart in Derek's project here: <a href="https://github.com/derekmolloy/boneDeviceTree/tree/master/docs" rel="nofollow noreferrer">https://github.com/derekmolloy/boneDeviceTree/tree/master/docs</a></p> <pre><code>/dts-v1/; /plugin/; / { compatible = "ti,beaglebone", "ti,beaglebone-black"; part-number = "mousetraps"; version = "00A1"; /* https://github.com/derekmolloy/boneDeviceTree/blob/master/docs/BeagleboneBlackP9HeaderTable.pdf */ fragment@0{ target = &lt;&amp;am33xx_pinmux&gt;; __overlay__ { mousetrap_pins: pinmux_mousetrap_pins { pinctrl-single,pins = &lt; 0x070 0x2f /* P9_11 30 INPUT MODE7 none */ 0x074 0x2f /* P9_13 31 INPUT MODE7 none */ 0x040 0x2f /* P9_15 48 INPUT MODE7 none */ 0x15c 0x2f /* P9_17 05 INPUT MODE7 none */ &gt;; }; }; }; fragment@1{ target = &lt;&amp;ocp&gt;; __overlay__ { test_helper: helper { compatible = "bone-pinmux-helper"; pinctrl-names = "default"; pinctrl-0 = &lt;&amp;mousetrap_pins&gt;; status = "okay"; }; }; }; }; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload