Go to advanced search

by [email protected]
Wed Dec 26, 2018 7:53 pm
Forum: C/C++
Topic: Wirring pi and SPI communication
Replies: 16
Views: 940

Re: Wirring pi and SPI communication

The wiringPi SPI code is just dumbed-down wrappers round the standard Linux kernel SPI code. They really are just one or 2 liners for those who don't know how to read the documentation. Read the source code to see what's happening, but in essence it's: snprintf (spiDev, 31, "/dev/spidev0.%d", channe...
by [email protected]
Mon Dec 10, 2018 10:38 am
Forum: C/C++
Topic: WiringPi Segmentation fault
Replies: 3
Views: 668

Re: WiringPi Segmentation fault

I see you're using softPwm - great, but if you use the hardware PWM, then you need to run it as root.

You might also want to look at the wiringSerial helpers - it has all the serial stuff you need too.

And note that millis () will wrap after 49 days.

-Gordon
by [email protected]
Tue Dec 04, 2018 11:56 am
Forum: C/C++
Topic: The most efficient way to transfer SPI data
Replies: 9
Views: 2493

Re: The most efficient way to transfer SPI data

I managed to write a benchmark program which measures the speed of GPIO and my previous error was that I was not buffering the reads. I am still using the WiringPi library. It can be observed that the more packets are being sent at once, the better bitrate is achieved, however this seems to plateau...
by [email protected]
Sat Nov 17, 2018 10:09 am
Forum: C/C++
Topic: External SRAM with Raspberry Pi 3
Replies: 8
Views: 1680

Re: External SRAM with Raspberry Pi 3

Don't use pinMode() on any SPI pins. the Linux kernel driver does the right thing when you have the SPI driver loaded at boot time (use rpi-config to make sure). Similarly you don't need to digitalWrite() to control the CE lines. The kernel driver does that for you. Essentially, you don't need wiri...
by [email protected]
Fri Nov 16, 2018 12:05 pm
Forum: C/C++
Topic: External SRAM with Raspberry Pi 3
Replies: 8
Views: 1680

Re: External SRAM with Raspberry Pi 3

Don't use pinMode() on any SPI pins. the Linux kernel driver does the right thing when you have the SPI driver loaded at boot time (use rpi-config to make sure). Similarly you don't need to digitalWrite() to control the CE lines. The kernel driver does that for you. Essentially, you don't need wirin...
by [email protected]
Wed Nov 07, 2018 12:10 pm
Forum: C/C++
Topic: Problems with mixing WiringPi Interrupts with forking to a child process
Replies: 2
Views: 1383

Re: Problems with mixing WiringPi Interrupts with forking to a child process

I've no idea why your program behaves as it does (and not really got time to look that closely at it. sorry), however note that wiringPiISR calls fork() and pthread_create() itself. These may or may not be having some sort of side-effect on your code.

-Gordon
by [email protected]
Mon Oct 29, 2018 3:16 pm
Forum: C/C++
Topic: DHT11 : C program not working but python program OK [solved]
Replies: 9
Views: 5375

Re: DHT11 : C program not working but python program OK [solved]

wiringPi supports these sensors natively - if this works for you: gpio -xrht03:100:7 aread 100 Returns temp * 10. To get the humidity, aread 101. then you can look at the source code to work it out. (the dht11 works the same as the rht03) https://git.drogon.net/?p=wiringPi;a=blob;f=examples/rht03.c ...
by [email protected]
Fri Mar 16, 2018 12:15 pm
Forum: C/C++
Topic: how can i use one button to controll 3 LEDs, plss help
Replies: 1
Views: 488

Re: how can i use one button to controll 3 LEDs, plss help

I'm not writing your code for you, but would just like to point out that you're calling wiringPiSetup() twice. This is an error. Even worse that you call it the first time to set bcm_gpio pin mode, wiringPiSetupGpio() then the 2nd time to set wiringPi pin mode. wiringPiSetup(); This is not going to ...
by [email protected]
Wed Mar 14, 2018 10:56 am
Forum: C/C++
Topic: wiringPi and the 3+
Replies: 0
Views: 757

wiringPi and the 3+

The current version of wiringPi; 2.44 will work fine on the new 3+ however the gpio readall command is somewhat fussy and will complain that it doesn't know the board, so I've released an updated version. Source in the usual place for those who take the source ( https://git.drogon.net/ ) but if you ...
by [email protected]
Wed Feb 28, 2018 12:17 pm
Forum: C/C++
Topic: wiringPi in C Language
Replies: 4
Views: 1057

Re: wiringPi in C Language

As well as the typo (compile with -Wall -Werror) you need to link in the library. Same way you'd link in the math library with -lm, link in wiringPi with -lwiringPi. wiringPi is not really intended for noobs to C programming though. Also type: gpio readall to list the pin numbers - wiringPiSetup(); ...
by [email protected]
Sun Dec 24, 2017 12:03 pm
Forum: C/C++
Topic: stretch wiringpi
Replies: 24
Views: 3048

Re: stretch wiringpi

The wiringPi package works OK under Stretch - I was able to compile and run some programs last night with it, using the installed package on a Pi 0W. My testing was using my old Ladder board under C and RTB BASIC, not that that makes any difference. You need to re-order your command-line. Put the co...
by [email protected]
Sun Dec 17, 2017 8:11 pm
Forum: C/C++
Topic: Problem with voltage measure with MCP3424 in c++
Replies: 22
Views: 2701

Re: Problem with voltage measure with MCP3424 in c++

Google can't find it because Gordon could be blocking the Googlebots on his small and overloaded website. Also you need a special level of Google Fu to find things like that (mainly because it doesn't contain "MCP3424" as a plain text string). I'm not blocking anything. Google can't find it simply ...
by [email protected]
Sun Dec 17, 2017 5:15 pm
Forum: C/C++
Topic: Problem with voltage measure with MCP3424 in c++
Replies: 22
Views: 2701

Re: Problem with voltage measure with MCP3424 in c++

1dot0 wrote:
Sun Dec 17, 2017 5:11 pm

where can I browse this with my Windows PC? How can Google find the MCP3424 in there?
I'm sorry. I don't think I can help you further.

-Gordon
by [email protected]
Sun Dec 17, 2017 4:40 pm
Forum: C/C++
Topic: Problem with voltage measure with MCP3424 in c++
Replies: 22
Views: 2701

Re: Problem with voltage measure with MCP3424 in c++

Where is the overview which lists all and everything? It's all in the source code. I just haven't had the time/energy to document everything due to other issues/illness in the past few years, sorry. -Gordon source code? where? The link I gave earlier - http://wiringpi.com/ See the download/install ...
by [email protected]
Sun Dec 17, 2017 3:43 pm
Forum: C/C++
Topic: Problem with voltage measure with MCP3424 in c++
Replies: 22
Views: 2701

Re: Problem with voltage measure with MCP3424 in c++

Where is the overview which lists all and everything?
It's all in the source code.

I just haven't had the time/energy to document everything due to other issues/illness in the past few years, sorry.

-Gordon
by [email protected]
Sun Dec 17, 2017 12:50 pm
Forum: C/C++
Topic: Problem with voltage measure with MCP3424 in c++
Replies: 22
Views: 2701

Re: Problem with voltage measure with MCP3424 in c++

Hey guys ! We want to get the voltage of our source with an MCP3424 using the i2c protocol between a raspberry pi3 ( the master ) and the MCP3424 ( the slave ). The problem is that we dont know how to setup our MCP3424 with an c++ code. There are examples online and there's always the source code -...
by [email protected]
Wed Nov 15, 2017 3:13 pm
Forum: C/C++
Topic: Help with ILI9225 display
Replies: 4
Views: 1568

Re: Help with ILI9225 display

Two things - firstly I'd try one screen with the hardware SPI, then if that works, then you can use all 4 with the hardware SPI by using alternative CE pins and manually setting those pins rather than let the hardware use the hardware CE pins. (I do this to let me run 3 SPI Thermocouple amplifiers o...
by [email protected]
Mon Nov 13, 2017 4:49 pm
Forum: C/C++
Topic: C code for MCP3008
Replies: 22
Views: 21365

Re: C code for MCP3008

I run raspi-config as sudo and enabled SPI and disabled I2C. Then I tried the command gpio load spi, but got these error: gpio: Unable to load/unload modules as this Pi has the device tree enabled. You need to run the raspi-config program (as root) and select the modules (SPI or I2C) that you wish ...
by [email protected]
Mon Nov 13, 2017 4:34 pm
Forum: C/C++
Topic: C code for MCP3008
Replies: 22
Views: 21365

Re: C code for MCP3008

Hello Gordon, thank you for your reply. These are the values of the variables: class PotController { private: //BASE is a new pin base for the chip of the analog pins const int MCP3008_BASE = 100; // chose the SPI_channel const int MCP3008_SPI_CHAN = 0; I tried the command but I received the follow...
by [email protected]
Mon Nov 13, 2017 11:11 am
Forum: C/C++
Topic: [done] Starting with C++
Replies: 6
Views: 1322

Re: Starting with C++

I double that: Too poor code examples for C to beginners available in complete tutorials, compared to Arduino or Python/Pi ! about temperature and humidity, what about that: http://www.uugear.com/portfolio/dht11-humidity-temperature-sensor-module/ /* * dht11.c: * Simple test program to test the wir...
by [email protected]
Mon Nov 13, 2017 11:05 am
Forum: C/C++
Topic: C code for MCP3008
Replies: 22
Views: 21365

Re: C code for MCP3008

I have tried to use wiringPi for a MCP3008 and Potentiometer like abouve, but I did not get any value. ... wiringPiSetupGpio (); ... mcp3004Setup(this->MCP3008_BASE, this->MCP3008_SPI_CHAN) ; // 3004 and 3008 are the same 4/8 channels ... int value = analogRead(this->MCP3008_BASE); ... Don't know h...
by [email protected]
Fri Nov 10, 2017 6:33 am
Forum: C/C++
Topic: Audio stream to GPIO with custom filter
Replies: 6
Views: 1078

Re: Audio stream to GPIO with custom filter

Hi, Going back to a basic example I am getting errors. Here is my simple program to read a prewritten PWM stream and the complete terminal session. At the end of the session I am getting undefined reference to errors. I get the same error with blink.c. I am on Ubuntu. Thanks in advance I'm sorry to...
by [email protected]
Thu Nov 09, 2017 4:34 pm
Forum: C/C++
Topic: Audio stream to GPIO with custom filter
Replies: 6
Views: 1078

Re: Audio stream to GPIO with custom filter

Hi again, I have the file opening, upsampling, custom filter and custom conversion for a GPIO format working well in JUCE on the PI. File chooser and format could be built in minutes in JUCE. I have also built a DAC circuit to connect to the GPIO. I am having trouble getting simple digital read and...
by [email protected]
Tue Nov 07, 2017 1:04 pm
Forum: C/C++
Topic: Reading GPIO pin
Replies: 2
Views: 692

Re: Reading GPIO pin

Did you test the hardware before jumping into code? If you did, then ignore this, but if not, then type this into a terminal: gpio -g mode 21 in while true; do echo -n `gpio -g read 21` ; done Then set/clear the input signal and make sure you get what you expect. Then debug the code. -Gordon
by [email protected]
Sun Oct 29, 2017 10:38 pm
Forum: C/C++
Topic: WiringPi removing SDcard gcc compiler code::blocks
Replies: 1
Views: 545

Re: WiringPi removing SDcard gcc compiler code::blocks

Are you absolutely sure you are running it as root? Currently if you try to use PWM without being root you will experience odd issues - like the SD card becoming offline.

wiringPi currently does not check for the pwm case requiring root.

-Gordon

Go to advanced search