Go to advanced search

by 1dot0
Tue Sep 19, 2017 3:18 pm
Forum: C/C++
Topic: help getting my program launched on the pi zero w
Replies: 14
Views: 1974

Re: help getting my program launched on the pi zero w

IIUC, what yodakohl wants to communicate is perhaps something like this pattern: #include <stdlib.h> #include <cstdlib> #include <iostream> using namespace std; void PlaySound(string filename){ system( ("aplay " + filename).c_str() ); } // ... PlaySound("m1.wav"); (tbh, not sure if stdlib.h is actua...
by 1dot0
Mon Sep 18, 2017 8:05 am
Forum: C/C++
Topic: interrupt o multithreading
Replies: 3
Views: 999

Re: interrupt o multithreading

hello, if you want to have multithreading, I once found a simplified pattern which works fine for me. It uses POSIX pthread threads running simultaneously in different infinite loops. Basically it looks like this: #include <stdio.h> #include <unistd.h> #include <pthread.h> //... void* thread1Name(vo...
by 1dot0
Sat Sep 16, 2017 12:49 pm
Forum: C/C++
Topic: First c program write in raspberry pi.
Replies: 55
Views: 45282

Re: First c program write in raspberry pi.

Yes, that's true, but why don't you just give the OP a chance to read, try, and reply to the suggested tutorial (which is using Geany), before constructing too far advanced issues ? ... Again, I would suggest to start working with this tutorial, step by step: http://fractal.math.unr.edu/~ejolson/pi/...
by 1dot0
Sat Sep 16, 2017 12:04 pm
Forum: C/C++
Topic: First c program write in raspberry pi.
Replies: 55
Views: 45282

Re: First c program write in raspberry pi.

I would suggest to stop arguing and hijacking this topic into the off.
Tutorials about starting with programming in C on the Pi have been linked to, possible issues have been sketched, and now it's to the OP to start with'em or not.
by 1dot0
Sat Sep 16, 2017 12:00 pm
Forum: C/C++
Topic: First c program write in raspberry pi.
Replies: 55
Views: 45282

Re: First c program write in raspberry pi.

just to talk about my statements, I never claimed that Windows is better. I just stated that writing programs in C(++) is way more complicated and confusing on the Pi than I was used to on Windows (examples given), and that's simply the way it is, period.
by 1dot0
Sat Sep 16, 2017 11:37 am
Forum: C/C++
Topic: First c program write in raspberry pi.
Replies: 55
Views: 45282

Re: First c program write in raspberry pi.

You don't have the sorts of editors and tools we take for granted on windows and then there is the whole makefile drama which doesn't exist on windows because the editors do all that grunt work and fire out the massive string to the compiler. I fully agree, I also come from Windows, and I am about ...
by 1dot0
Sat Sep 16, 2017 9:43 am
Forum: C/C++
Topic: First c program write in raspberry pi.
Replies: 55
Views: 45282

Re: First c program write in raspberry pi.

that's quite exactly the tutorial I had linked to (CMIIW), but my link is a modified/revised edition.
http://fractal.math.unr.edu/~ejolson/pi ... dified.pdf
(check it if you wish to)
by 1dot0
Sat Sep 16, 2017 9:38 am
Forum: C/C++
Topic: First c program write in raspberry pi.
Replies: 55
Views: 45282

Re: First c program write in raspberry pi.

cross-compiling on a PC or even remotely via ssh and puTTY are far more complicated than simply edit+compile+run directly locally on the Pi, with an HDMI screen and USB keyb/mouse. Again, I would suggest to start working with this tutorial, step by step: http://fractal.math.unr.edu/~ejolson/pi/Essen...
by 1dot0
Fri Sep 15, 2017 8:42 pm
Forum: C/C++
Topic: First c program write in raspberry pi.
Replies: 55
Views: 45282

Re: First c program write in raspberry pi.

Thanks rpdom and jahboater. very helpful It is all strange to me coming from MS Win, CCS "C", and MPLAB programming PICs. Where do I look up command line instructions? A book on C? I don't remember seeing or using this in my C programming. Edit: Thanks everyone; I now have my first C program runnin...
by 1dot0
Thu Sep 14, 2017 7:45 am
Forum: C/C++
Topic: Unable to read Pi input
Replies: 3
Views: 799

Re: Unable to read Pi input

I don't know your encoder and don't understand your code, but
- where do you setup wiringPi? By which pin numbering scheme?
by 1dot0
Fri Sep 08, 2017 6:13 pm
Forum: OpenVG
Topic: Transparent background
Replies: 11
Views: 14487

Re: Transparent background

is there already a revision of openvg for Stretch within the range of vision? ;)
by 1dot0
Fri Sep 08, 2017 7:39 am
Forum: C/C++
Topic: High speed rotary encoder reading
Replies: 11
Views: 8191

Re: High speed rotary encoder reading

I'd farm it out, use something like a digital counter chip or a PIC to talk to the motors, then have the Pi talk to that. Or maybe do it in assembly. But the Pi probably doesn't need to be concerned with every routine 1/1024 revolution, only when you're close to something, so have different subrout...
by 1dot0
Wed Sep 06, 2017 2:42 pm
Forum: C/C++
Topic: High speed rotary encoder reading
Replies: 11
Views: 8191

Re: High speed rotary encoder reading

ok, then the code I posted is supposed to work reliably for your setup, too.
by 1dot0
Wed Sep 06, 2017 1:21 pm
Forum: C/C++
Topic: High speed rotary encoder reading
Replies: 11
Views: 8191

Re: High speed rotary encoder reading

BTW, @GrahamBriggs :

which is your rotation speed (rev/sec) at the encoder axle actually?
by 1dot0
Wed Sep 06, 2017 11:57 am
Forum: C/C++
Topic: High speed rotary encoder reading
Replies: 11
Views: 8191

Re: High speed rotary encoder reading

Well, unless you want to argue that any userland thread can be suspended by the kernel for an arbitrary time, it will be kind of difficult to prove your "disagreement". ;-) Still, sampling 4 encoders with 8 signal lines (even at a low signal speed of 2400 pulses per second) over 30 minutes on a bus...
by 1dot0
Wed Sep 06, 2017 10:28 am
Forum: C/C++
Topic: High speed rotary encoder reading
Replies: 11
Views: 8191

Re: High speed rotary encoder reading

It won't work reliably on a Linux userland thread which gets interrupted and suspended by the kernel. I have to disagree, I am runing simultaneously USB-WiFi and USB-BT and UART and USB-FTDI and SPI and i2c and HDMI output in different other threads (lower priority), but even after 30 minutes const...
by 1dot0
Wed Sep 06, 2017 9:24 am
Forum: C/C++
Topic: High speed rotary encoder reading
Replies: 11
Views: 8191

Re: High speed rotary encoder reading

I am using 360-720 ticks/360° encoders at 200rpm, and I can read them (up to 6, tested) without issues in a high priority pthread Thread by 100µs loops, but I am sure they will also run even quicker (pin reading by pthread works even at < 1µs). I am using no interrupts, just always reading pin state...
by 1dot0
Sat Aug 26, 2017 8:48 am
Forum: OpenVG
Topic: Transparent background
Replies: 11
Views: 14487

Re: Transparent background

Scratch?
Do you mean Stretch?
haha, yes, sure, Stretch :D
by 1dot0
Sat Aug 26, 2017 7:32 am
Forum: C/C++
Topic: Using OpenCV with Raspberry Pi camera
Replies: 8
Views: 15151

Re: Using OpenCV with Raspberry Pi camera

that's about Python, not about C, or am I wrong? Python indeed is much easier than C, as far as I observed.
by 1dot0
Fri Aug 25, 2017 8:16 am
Forum: Beginners
Topic: pin numbering: wiringPi website vs. others?
Replies: 9
Views: 2010

Re: pin numbering: wiringPi website vs. others?

for wiringPi I already am using the BCM-numbers. What was puzzling me was the outdated wiringPi website where only the 26 pin headers are showed, and then these in 2 different variants, plus an additional header beyond, beneath (??) or underneath (??) which does not exist actually. A 40-pin header w...
by 1dot0
Fri Aug 25, 2017 8:00 am
Forum: OpenVG
Topic: Transparent background
Replies: 11
Views: 14487

Re: Transparent background

hello, if you use Paeryn's fork then you'll have additionally the function void WindowOpacity(unsigned int alpha) https://github.com/paeryn/openvg/ That works fine with my openVG on Jessie, but as I just read in the C++ sub-forum, openVG can not be installed properly on Scratch (edit:) Stretch yet.
by 1dot0
Thu Aug 17, 2017 5:24 pm
Forum: Beginners
Topic: pin numbering: wiringPi website vs. others?
Replies: 9
Views: 2010

Re: pin numbering: wiringPi website vs. others?

thanks to all, indeed it's clear now - the wiringPi GPIO scheme in my opening post which puzzled me at the first glance showed the same secondary header like my schematic (it just couldn't be c+p'ed) , and the primary header actually was not quite updated to the 40 GPIO pinout. Probably the wiringPi...
by 1dot0
Thu Aug 17, 2017 11:52 am
Forum: Beginners
Topic: pin numbering: wiringPi website vs. others?
Replies: 9
Views: 2010

pin numbering: wiringPi website vs. others?

hi, I found the following pin layout on the wiringPi website which are really puzzling me: https://projects.drogon.net/raspberry-pi/wiringpi/pins/ P1: The Main GPIO connector: wiringPi Pin BCM GPIO Name Header Name BCM GPIO wiringPi Pin — — 3.3v 1 | 2 5v — — 8 R1:0/R2:2 SDA 3 | 4 5v — — 9 R1:1/R2:3 ...
by 1dot0
Sun Aug 13, 2017 8:26 am
Forum: C/C++
Topic: importance of flag -lrt ?
Replies: 6
Views: 2033

Re: importance of flag -lrt ?

All the answers are sort of correct :-) librt has been deprecated in part or whole on a number of libraries and compilers most noticably new versions of Glibc. So there is no one answer here it depends what compiler and library versions you are using. If you are using the Raspbian compiler GCC 4.8 ...
by 1dot0
Sat Aug 12, 2017 4:10 pm
Forum: C/C++
Topic: importance of flag -lrt ?
Replies: 6
Views: 2033

Re: importance of flag -lrt ?

Probably cant give better explanation than the man page: https://docs.oracle.com/cd/E19455-01/806-0632/6j9vm89ic/index.html thank you, so does that mean: if one does not use either of the following functions then one would never need to use -lrt, correct? SUNW_1.1 (generic): aio_cancel aio_error ai...

Go to advanced search