Closed Luuii closed 9 years ago
We need i2c too. Is there any way to access i2c via the gpio module? Our school project is a web based weather station... raspberry pi with coder with i2c... the solution!
Is it useful to install i2c as described below? http://www.instructables.com/id/Raspberry-Pi-I2C-Python/
If yes -> how to login? (need login name and password of coder)
I'll add the pi-spi and i2c node modules to the coder package. I haven't done a lot of development or testing with these yet, so if you are hacking with this and have experience here, please let me know.
I have installed the I2C modules from npm and it works very well in coder v0.5. There is no difficult to install de module if your follow the instructions from https://www.npmjs.org/package/rasp2c. I did via ssh. The module can detect i2c addresses and behave like a I2C Master.
I've installed the the i2c and bmp085 packages and i can detect my i2c module by using the console and i2cdetect command. That's all i can do. If i attempt to use BMP05 in my JS in coder i get an error.
//This code results in an error... var BMP085 = require('sensor_bmp085'); var sense = new BMP085(); // <--- ERROR here : Uncaught TypeError: object is not a function
$(document).ready( function() {
//This code will run after your page loads
sense.init(function(err, val) {
if (!err) {
sense.getTemperature(function(error, val) {
if (!error) {
console.log(val + ' °C');
sense.getPressure(function(error, val) {
if (!error) {
console.log(val + ' °C');
}
});
}
});
}
});
});
Got a test working with pi_spi to read data from the MCP8003 analog to digital converter. https://github.com/googlecreativelab/coder/tree/master/coder-apps/tests/spi_test
I'll order a BMP085 sensor to build a test for I2C.
I've uploaded a fresh new image that contains the i2c and pi-spi modules. Get it here: http://googlecreativelab.github.io/coder/#download
BTW, here's the docs on these: https://github.com/natevw/pi-spi https://github.com/kelly/node-i2c
Hi Jason, I got a test good working with the I2C Devices MCP23017 Port Expander
Passing trough to an another subject, I I would like to know how you do a Coder image with the new requirements. In order to keep simplicity, I would like to do a versión with my own and custom modules, default web apps and custom properties. If I have this, I could only share the image and copy to anyone.
@Luuii I basically do this:
On the mac you put the disk in, then unmount it with:
sudo diskutil unmount /dev/disk2s1
/dev/disk2 on my machine is where my sdcard pops up. You'll need to adjust if this is different. Then you image it with:
dd bs=1m if=/dev/rdisk2 of=raspi.img count=2900
That's copying 2900 1-MB blocks, which is enough to get the partitions plus a little to spare. If you change the partition table, you'll need to do the math and adjust as necessary.
Thank you Jason, in the next time I will try to do your specifications and I will maintain contact.
Is there a develop library i2c built in the new Coder GPIO Module ?