Comments (18)
Hi, I will make a couple of quick questions, to understand the problem...
-
you have enabled SPI? There are many ways to do it, simple mode:
raspi-config -> Advanced Option -> SPI -
to have a confirmation on the operation of SPI do:
lsmod | grep bcm -
you can make a photo at the cable connection?
-
since the last update and 'added a SPI2 class that I have not tested adc3008, you are using SPI or SPI2?
thanks for the tip :)
from ofxgpio.
- spi is already enabled
- snd_bcm2835 20511 1
snd_pcm 75698 1 snd_bcm2835
snd 51844 5 snd_bcm2835,snd_timer,snd_pcm
bcm2835_wdt 3225 0
bcm2835_gpiomem 3040 0
spi_bcm2835 7286 0 - i am using spi, not spi2
3 pictures are in a few minutes
from ofxgpio.
from ofxgpio.
you can publish your program setup that contain the "new = SPI()" ?
from ofxgpio.
#include "ofMain.h"
#include "ofAppNoWindow.h"
#include "ofxGPIO.h"
class noWin : public ofBaseApp{
public:
SPI * spi;
int i;
int a2dVal;
int a2dChannel;
unsigned char data[3];
void setup(){
i = 20;
a2dVal = 0;
a2dChannel = 0;
spi = new SPI("/dev/spidev0.0", SPI_MODE_0, 1000000, 8);
}
void update(){
data[0] = 1;
data[1] = 0b10000000 |( ((a2dChannel & 7) << 4));
data[2] = 0;
spi->spiWriteRead(data, sizeof(data) );
a2dVal = 0;
a2dVal = (data[1]<< 8) & 0b1100000000;
a2dVal |= (data[2] & 0xff);
sleep(2);
ofLog()<<"Result: " << a2dVal;
}
};
int main( ){
ofAppNoWindow window;
ofSetupOpenGL(&window, 0,0, OF_WINDOW);
ofRunApp( new noWin() );
}
from ofxgpio.
This is your spi example, which i am using.
from ofxgpio.
you've tried to use interface: /dev/spidev0.1 ?
from ofxgpio.
i tried now
spi = new SPI("/dev/spidev0.1", SPI_MODE_0, 1000000, 8);
but the same error.
from ofxgpio.
I'm trying MCP3008 in the laboratory, short update you
from ofxgpio.
ok the problem exists, but appears to be closely tied to 9.x of openFrameworks paired with a combination of reading from SPI.
In fact, if you try to run this example outside openFrameworks or with a version of openFrameworks < 9.x running fine.
I am attaching an example in C ++ to use without openFrameworks.
extract the zip file in the /home/pi/
cd mcp3008/
make
./main
let me know if this example outside openFrameworks works for you.
in a while I try to figure out the problem, I leave this open.
from ofxgpio.
wow, thank you for this example, this is working.
from ofxgpio.
Have you solved this issue yet?
from ofxgpio.
hello @xumo , I'm sorry I fix this in September I am now out for work.
from ofxgpio.
Do you have any hints, I need deliver earlier? I'l try with OF 8.4, but cannot seem to find the release tar in the main site.
Thanks anyway, this is an awesome addons.
from ofxgpio.
Hi @xumo
a simple solution without changing the version is to use the demon that you find in the zip writing in a socket are also an example openFrameworks to read socket.
Good day
from ofxgpio.
Yei, thanks a lot.
from ofxgpio.
Hi guys @urbanpixellab @xumo,
I think I've solved the problem with SPI.
good day
from ofxgpio.
That's great. I'll test it as soon as I can.
from ofxgpio.
Related Issues (20)
- ADS1015 GPIO HOT 1
- Problem example-i2c-scanner HOT 1
- Can't compare ofstream or ifstream to int in gpio.cpp HOT 4
- example-apa102-ledstrip not lighting leds with Stretch HOT 5
- Use SPI1 for APA102 HOT 5
- 12c examples HOT 9
- Gpio io HOT 5
- Orange Pi 4G IOT HOT 2
- Cannot make SPI work HOT 2
- unable to set direction of gpio HOT 1
- Setting pull up resistors HOT 7
- how do i add ofxGPIO to an existing project? HOT 1
- servo example on rpi 2 - no movement HOT 1
- for Asus TinkerBoard HOT 1
- OPERATION FAILED: Unable to set direction of GPIO4 - openFrameworks not working HOT 2
- Adapting read-write example to distance sensor HOT 5
- using spi1 with MCP
- Issues with using input and output and startup.
- doesnt seems to work with RPi5 Bookworm 0F12.0 arch64 HOT 2
- error open frameworks compiling with window HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ofxgpio.