Hello,
My first time ever using a BB platform. ID10T newbie.
I'm trying to use the board along with a BMP280 sensor for Pressure and
Temperature.
I'm having no skill or luck with it. I've sprungboard off of a post showing
how to implement a driver for the BMP085 which is an earlier version of the
same sensor.
The link: BMP_on_the_Beagle_Bone_Black
<http://elinux.org/Beagleboard:BMP_on_the_Beagle_Bone_Black>
I've tried the command line commands as such.
echo bmp280 0x77 > /sys/class/i2c-adapter/i2c-1/new_device
root@beaglebone:~# dmesg | grep bmp
[ 785.694384] i2c i2c-1: new_device: Instantiated device bmp280 at 0x77
root@beaglebone:~# cat /sys/bus/i2c/drivers/bmp280/1-0077/temp0_input
root@beaglebone:~# cat /sys/bus/i2c/drivers/bmp280/1-0077/temp0_input: No
such file or directory
Not working as you can see.
Then I tried to modify and re-use Juan Corez example. Also, the same
output. No such file or directory.
***************************BMP280.js***************************************
* Created on: 6-12-2013
* Revised on: 6-13-2013
* BMP085 Author: Juan Cortez, Modified by me for the BMP280.
* Works on: 06-08-12 image or later on both BeagleBone and BeagleBone Black
* Reads temperature and pressure from the BMP280 Sensor
* Input: Sensors on the BMP280 Sensor
* Output: Outputs the readings on the console.
* Special Instructions: Run code once as it is. You will get an error but
it is OK.
* Comment out the b.writeTextFile(bmp280....); line, save and run the code
again.
*******************************************************************************/
var b = require('bonescript');
var bmp280= '/sys/class/i2c-adapter/i2c-1/';
//Sensor Locations on the BeagleBone Black
var temperature= '/sys/bus/i2c/drivers/bmp280/1-0077/temp0_input';
var pressure= '/sys/bus/i2c/drivers/bmp280/1-0077/pressure0_input';
/* We will initialize the driver for the BMP280 sensor located at I2C
location 0x77.*/
/* !NOTE!: You only have to initialize the driver once. Once you run the
code once, comment out the next line. (i.e. b.writeTextFile....) */
//b.writeTextFile(bmp280 + 'new_device', 'bmp280 0x77');
/************************************Comment out the line above after you
run the code once***********************************************/
/* Opens,reads, and prints pressure and temperature. */
b.readTextFile(pressure, printPressure);
b.readTextFile(temperature,printTemperature);
/* Prints Pressure */
function printPressure(x) {
console.log("Pressure: ", x.data/100 + " millibar");
}
/* Prints Temperature */
function printTemperature(x){
console.log("Temperature: ", x.data/10 + '\xB0' + " Celcius"); // '\xB0'
is decimal in hexademical
x.data /= 10;
x.data *= 1.8;
x.data += 32;
console.log("or: ", x.data + '\xB0' + " Fahrenheit");
}
Could someone please gently point me in the right direction?
Thanks in advance,
Mike
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.