Disclaimer: not so advanced here!

Let me explain why I am looking for C code because the motivation itself maybe flawed. If I want to transport my Raspberry Pi project to the realm of customized hardware, embedded systems and ARM microprocessors (say for product development purposes), shouldn't I need to code in C since in most cases only C code can be compiled and executed by ARM processors? So if I am currently using python code, bash scripts, terminal commands, etc. to receive camera streams, would they help if I want to control the camera by customized hardware and ARM processors? (which may/may not run the complete linux operating system)

Example terminal command programs for which I need help getting C code equivalents:

1) This generates video stream on port 5001 at certain frame rate and dimension, using netcat. The latency is satisfyingly low and this is a requirement: raspivid -n -ih -t 0 -rot 0 -w 1280 -h 720 -b 1000000 -fps 15 -o - | nc - lkv4 5001

2) Waking the Raspberry Pi from sleep with GPIO interrupts. The method given in this link primarily uses bash scripts: https://howchoo.com/g/mwnlytk3zmm/how-to-add-a-power-button-to-your-raspberry-pi

Thanks in advance!

  • As regards you "motivation" preamble: If this is your concern, you should do some research into your target platform. It's true that C will port to many systems whether some of the other techniques that you list may not. (No shell script on Arduino, just as an example.) But, you could easily develop something out in C and then find that you used libraries or hardware that's not compatible with what you ultimately want to do and by stuck anyway.
    – Brick
    Feb 28 '19 at 15:33

Seeing as the raspivid source code is open source and available, for your first example at least you can download the C code; modify it with the hardcoded parameters you want and add you own networking part to replicate what netcat is doing with the output.

The second example is simply waiting for an event on the GPIO and doing a system call, nothing that couldn't be done in C with the GPIO library of your choice and calling system().


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.