Go to advanced search

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: 425

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: 566

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: 894

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: 2606

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: 2371

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: 2371

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: 2371

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: 2371

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: 2371

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: 1365

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: 20333

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: 20333

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: 1215

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: 20333

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: 984

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: 984

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: 657

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: 510

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
by [email protected]
Fri Oct 13, 2017 5:09 pm
Forum: C/C++
Topic: WiringPi Serial help
Replies: 8
Views: 1299

Re: WiringPi Serial help

Hi 1dot0, thank you for the reply. 1) if it can never be -1, what then should i put instead? Well - firstly you ought to use CODE tags round the code - it makes it easier for people to read. then you need to start reading the fine manuals where it tells you what the return code is - it's an integer...
by [email protected]
Fri Oct 13, 2017 1:56 pm
Forum: C/C++
Topic: WiringPi Serial help
Replies: 8
Views: 1299

Re: WiringPi Serial help

you should check the return code from serialOpen(), however that's not your issue - the issue is that output is buffered until you print a new line, so either append a newline \n to the printf() or call fflush (stdout); after the printf() call.

-Gordon
by [email protected]
Mon Oct 02, 2017 8:58 am
Forum: Other programming languages
Topic: Porting ARM BASIC to the Raspberry Pi via SDL 2.0
Replies: 89
Views: 16838

Re: Porting ARM BASIC to the Raspberry Pi via SDL 2.0

Having checked out the data file input capabilities of both RTB and FUZE Basic [sic], I found that it seems they are not really capable of reading binary data which would appear in an image file. Just as I was determining that RTB and FUZE Basic [sic] would not likely be able to serve my needs, I d...
by [email protected]
Sun Oct 01, 2017 11:25 am
Forum: C/C++
Topic: Closing serial port when doing ^C
Replies: 4
Views: 1294

Re: Closing serial port when doing ^C

I'm somewhat confused here - when you ^C a program, all files are automatically closed. This includes things like serial ports. You can not normally leave files open when your program terminates. So it sounds like something else is going on. When serialOpen() returns -1, then errno will be set - it ...
by [email protected]
Tue Sep 26, 2017 2:23 pm
Forum: C/C++
Topic: Serial Port RAW mode
Replies: 6
Views: 2890

Re: Serial Port RAW mode

Code: Select all

#include <wiringSerial.h>

...

  fd = serialOpen ("/dev/ttyUSB0", 115200) ;
  ...
  while (serialDataAvail (fd))
  {
  ... do stuff, etc.
  }
From the "make life easy for you" department.
-Gordon
by [email protected]
Wed Sep 20, 2017 8:56 am
Forum: C/C++
Topic: Simple GPIO access in C
Replies: 25
Views: 26892

Re: Simple GPIO access in C

One if the issues using your own hardware poking is that you need to be aware of a few things - and one is that the hardware address is not the same over all Pi models. It changed. That's one reason to use someone elses library - they all detect the change for you. e.g. using wiringPi, #include <wir...
by [email protected]
Thu Sep 14, 2017 1:15 pm
Forum: C/C++
Topic: Unable to read Pi input
Replies: 3
Views: 585

Re: Unable to read Pi input

Hi everyone, So I am trying to read in the state of a PWM MA3 absolute rotary encoder with the Raspberry Pi. When I run the code below, only values of zero are being printed. When I run the Python equivalent code, I get a series of ones and zeros, so I'm not sure what I am doing wrong with the C co...

Go to advanced search