Go to advanced search

by gordon@drogon.net
Wed Mar 13, 2019 11:25 am
Forum: C/C++
Topic: WiringPI
Replies: 4
Views: 337

Re: WiringPI

Hi guys, I have a problem with the installation of the WiringPI library I followed the steps that came in a web page everything well recognizes me the library but the problem is that it recognizes the library but not the functions of this library. Please, if someone knows that I am failing, I would...
by gordon@drogon.net
Wed Mar 13, 2019 10:54 am
Forum: C/C++
Topic: CodeBlocks and pigpio
Replies: 11
Views: 414

Re: CodeBlocks and pigpio

With WiringPi you can set an environment variable to allow it to run without sudo. You have clearly caught a dose of sudoitis. That's a nasty disease where Raspberry users assume the answer to all problems is sudo. export WIRINGPI_GPIOMEM=1 in bash. Or do it in C programs with setenv ("WIRINGPI_GPI...
by gordon@drogon.net
Sat Jan 26, 2019 8:11 pm
Forum: C/C++
Topic: hardware pwm without wiringpi or other libraries
Replies: 7
Views: 581

Re: hardware pwm without wiringpi or other libraries

I was going to ask a simular question. perhraps this will be a good place to ask. i'm wanting to use pwm to control 2 motors. but it seems the wiringpi library only allows for 1 pin? thus controlling only one motor. I need to control 2. correct me if im wrong you're wrong. It supports both PWM chan...
by gordon@drogon.net
Wed Dec 26, 2018 7:53 pm
Forum: C/C++
Topic: Wirring pi and SPI communication
Replies: 16
Views: 1483

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 gordon@drogon.net
Mon Dec 10, 2018 10:38 am
Forum: C/C++
Topic: WiringPi Segmentation fault
Replies: 3
Views: 877

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 gordon@drogon.net
Tue Dec 04, 2018 11:56 am
Forum: C/C++
Topic: The most efficient way to transfer SPI data
Replies: 9
Views: 3467

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 gordon@drogon.net
Sat Nov 17, 2018 10:09 am
Forum: C/C++
Topic: External SRAM with Raspberry Pi 3
Replies: 8
Views: 3065

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 gordon@drogon.net
Fri Nov 16, 2018 12:05 pm
Forum: C/C++
Topic: External SRAM with Raspberry Pi 3
Replies: 8
Views: 3065

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 gordon@drogon.net
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: 2530

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 gordon@drogon.net
Mon Oct 29, 2018 3:16 pm
Forum: C/C++
Topic: DHT11 : C program not working but python program OK [solved]
Replies: 9
Views: 7061

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 gordon@drogon.net
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: 547

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 gordon@drogon.net
Wed Mar 14, 2018 10:56 am
Forum: C/C++
Topic: wiringPi and the 3+
Replies: 0
Views: 949

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 gordon@drogon.net
Wed Feb 28, 2018 12:17 pm
Forum: C/C++
Topic: wiringPi in C Language
Replies: 4
Views: 1203

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 gordon@drogon.net
Sun Dec 24, 2017 12:03 pm
Forum: C/C++
Topic: stretch wiringpi
Replies: 24
Views: 3591

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 gordon@drogon.net
Sun Dec 17, 2017 8:11 pm
Forum: C/C++
Topic: Problem with voltage measure with MCP3424 in c++
Replies: 22
Views: 3009

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 gordon@drogon.net
Sun Dec 17, 2017 5:15 pm
Forum: C/C++
Topic: Problem with voltage measure with MCP3424 in c++
Replies: 22
Views: 3009

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 gordon@drogon.net
Sun Dec 17, 2017 4:40 pm
Forum: C/C++
Topic: Problem with voltage measure with MCP3424 in c++
Replies: 22
Views: 3009

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 gordon@drogon.net
Sun Dec 17, 2017 3:43 pm
Forum: C/C++
Topic: Problem with voltage measure with MCP3424 in c++
Replies: 22
Views: 3009

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 gordon@drogon.net
Sun Dec 17, 2017 12:50 pm
Forum: C/C++
Topic: Problem with voltage measure with MCP3424 in c++
Replies: 22
Views: 3009

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 gordon@drogon.net
Wed Nov 15, 2017 3:13 pm
Forum: C/C++
Topic: Help with ILI9225 display
Replies: 4
Views: 1723

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 gordon@drogon.net
Mon Nov 13, 2017 4:49 pm
Forum: C/C++
Topic: C code for MCP3008
Replies: 22
Views: 22603

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 gordon@drogon.net
Mon Nov 13, 2017 4:34 pm
Forum: C/C++
Topic: C code for MCP3008
Replies: 22
Views: 22603

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 gordon@drogon.net
Mon Nov 13, 2017 11:11 am
Forum: C/C++
Topic: [done] Starting with C++
Replies: 6
Views: 1449

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 gordon@drogon.net
Mon Nov 13, 2017 11:05 am
Forum: C/C++
Topic: C code for MCP3008
Replies: 22
Views: 22603

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 gordon@drogon.net
Fri Nov 10, 2017 6:33 am
Forum: C/C++
Topic: Audio stream to GPIO with custom filter
Replies: 6
Views: 1175

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...

Go to advanced search