Hardware Reference
In-Depth Information
NOTE
If you log in as root , your home directory is /root . That is, anyone can cd /root to get
into your home directory (though directories are initially locked). If you log in as debian ,
your home is /home/debian . If you were to create a new user called newuser , that user's
home would be /home/newuser . By default, all non-root (non-superuser) users have their
home directories in /home .
The following commands create a new directory for the sensor recipes, change to it, and
use touch to create an empty file called pushbutton.js :
root@beaglebone:/var/lib/cloud9# cd /root
root@beaglebone:~# mkdir boneSensors
root@beaglebone:~# cd boneSensors
root@beaglebone:~/boneSensors# touch pushbutton.js
Now, add recipe code to the newly created pushbutton.js file to enable it to run:
1. In Cloud9, in the Workspace browser on the left, go to the Preferences wheel and
select Add Home to Favorites ( Figure 1-22 ). Now, your home directory will show
up in the Workspace file tree.
2. In the Workspace browser, expand root .
3. You will see your newly created boneSensors directory; expand it. You will see
your empty pushbutton.js
4. Double-click the pushbutton.js file to open it.
5. Paste the code for the recipe you want to run. This example uses Example 2-1 .
6. Press ^S (Ctrl-S) to save the file. (You can also go to the File menu in Cloud9 and
select Save to save the file, but Ctrl-S is easier.)
7. In the bash tab, enter the following commands:
root@beaglebone:~/boneSensors# chmod +x pushbutton.js
root@beaglebone:~/boneSensors# ./pushbutton.js
Interrupt handler attached
Search WWH ::




Custom Search