I have a plan to operate 5MP camera module with the arduino Due. But I wonder if I can use the arduino libraries that include digitalRead, digitalWrite and so on. But some people said that it is a bad idea. Especially I found that people wrote values on registers instead of using the library, when they control ov7670 with Uno.

Contrary to this, ArduCam uses the libraries, even for OV5642!. Here is the link https://github.com/ArduCAM/Arduino/blob/master/ArduCAM/examples/mini/ArduCAM_Mini_OV5642_Video_Streaming/ArduCAM_Mini_OV5642_Video_Streaming.ino

So could anyone please let me know, if it is okay to use such library and never to use register directly? With 'register' I mean arduino's register, not camera's.

I guess the system clock and existence of FIFO would affect the answer. But still I don't know how to evaluate their effect analytically.

  • I don't see any digitalWrite call in that that library.
    – Gerben
    Aug 12, 2015 at 14:30

2 Answers 2


Unless you have a really large number of read/write operations and very tight time constraints, I doubt you are going to have any significant advantage in terms of speed.

Accessing the bits in a port together, rather than individually is certainly more efficient, both in terms of time and space, but it might cost in readability, depending on how comfortable you are with leaving the Arduino libraries behind.

You can have also a look at this thread.

Notice that the maximum gain happens only when all the pins you have to read or write belong to the same register.


You can use ANY and ALL libraries (if their LICENCies allows it) you want, or none library at all.

More important is, if the result does what you need.

For some kinds of problems even very slow library is fast enought. For some kinds only highly optimized library can do. Some problems are so complex, that any Arduino cannot do it even with the best effort and total optimization of code and HW resources. (Well, for some problems even todays best supercomputers are not good enough)

Lot depends on what exactly you plan to do with such camera - if you need some simple controls (like START, STOT, change sesitivity ...) maybe anything is good. If you want to make some autonomous system navigated by vison system which would learn from experience and will recognize all your face expression, than there is no Arduino with needed computing power at all.

Just try find any project vaguelly similar to yours, look, what they are using and what they say about it (excelent, barely usable, we found it impossible) and try library/approach based on that. If it works somehow, make it better and be celebrity too :) If it does not work at all and does not yeld any usable results, maybe try something different.

A lot can be done, if you enhance Arduinos capabilities with external modules (commercial or home made) be it in form of shield or in form of totally different platform.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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