gpiozero vs rpi.gpio library Performance + Control [closed] - raspberry-pi

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I am concerned about the pros and cons of using gpiozero over the old rpi.gpio library, is there any performance difference or lower-level control difference?
I read this forum and it didn't really answer my question
https://www.raspberrypi.org/forums/viewtopic.php?t=204466
what I got from that forums was that it was a wrapper around the standard rpi library, typically from my programming experience wrappers tend to be slower and provide less flexibility in exchange for ease of use
however, since that wasn't specified in the forums and I do not know if the performance difference is small-big its hard to know which one I should use

Why Is GPIO Zero's Approach Better?
It is easy to read and short as possible. The gpiozero module always uses Broadcom GPIO numbering to identify a GPIO, so there is no setup necessary. There is a little explanation for that:
BOARD numbering might seem simpler but I'd say it leads new users to think all the pins are general purpose---and they're not. Connect an LED to pin 11, why not connect some more to pins 1, 2, 3 and 4? Well 1 is 3V3. 2 and 4 are 5V. A lack of awareness of what the purpose of the pins is can be dangerous.
Is GPIO Zero Actually Better?
On the one hand, removing the setup code is excellent for beginners and seasoned coders alike. Writing code is more straightforward and quicker. On the other hand, knowing exactly what is going on is important for learning.
I found this description in this article. So I think if you know what you do or if you want to see how it works I would use gpiozero. But if you want to set all pins yourself I would use rpi.gpio.

Related

Master thesis on developping Twincat3 driver [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
If there is any PLC programmer or Twincat3 user out there. I would like to write my master thesis on Twincat3 in a company. Basically, They have different kinds of the Test bench, and they want someone to develop drivers for them. I have no experience with PLC or C++ or IEC61131 languages. Is it possible to learn any of these in 3 months, and then start writing the thesis? I have three months of Internship time before starting. I am having a bit of doubt. Even though it is daunting as an Electrical engineering student, I have no other options.
I thank you in Advance.
Also, The test benches are mainly Powerelectronics or Electrical machine test bench. I believe I need to automate the test processes in twincat3.
Best Regards
Good choice with TwinCAT 3. TwinCAT 3 is very capable, and quite easy to learn (of course dependent on your background, but generally a good platform to work on).
All I can support you with is a link to a TwinCAT 3 tutorial that I've created that is free of charge (available on YouTube):
https://www.youtube.com/playlist?list=PLimaF0nZKYHz3I3kFP4myaAYjmYk1SowO
There are also some other resources available both on YouTube and on the website. I've created a set of links here to help you find all the resources you might need.
To answer your question I would say it depends. Three months is not much time, especially considering you probably have a lot of other things that need to go in there (doing studies, writing the thesis, implementation, conclusions etc). It depends on the complexity of your project (it's not very specific what "writing drivers for them" means). If it's a simple project (including a very basic set of I/Os) it might be do-able. If it's anything more complex (like needing to add a front-end, doing motion control and maybe even safety) then it's most likely going to be hard to finish it in three months.
But again, I think more details on what you want to achieve is necessary.

What perl web framework to use for the old CGI based perl code? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
Yes, while i'm working on node.js, i still love perl, :)
The old web product is based on old perl CGI, i'm looking to the simplest way to fix XSS/Sql injection/etc. web security holes, within a week including testing, :(
So for
Catalyst
Dancer
Mason
Maypole
Mojolicious
which one should i use in the ARM platform ?
Thank you !
You have fallen foul of the primarily opinion-based off-topic categorisation, and your question will probably be closed very soon. However I think it's worth offering a few guidelines here
First of all you should absorb what is written in CGI::Alternatives as it is a reasonable summary of the subject
Next you should separate the HTML generation functionality of your existing CGI code from the interface itself, and consider replacements for each of them separately. If you were to use HTML::Tiny together with CGI::Simple then your code would have to change very little and you would have achieved better partitioning of functionality
Ideally you will move on to one of the many templating systems such as Template Toolkit, together with one of the frameworks, which is the topic of your question. In the end you will need to do a lot of research and many trials to discover how well each framework fits your requirement, in terms of both the feature list and the convenience and clarity of the API
All I can do here is say that I am very fond of the Mojolicious suite and suggest that it may be a good starting point. The API focuses on command chaining in a way similar to Ruby, and there is a Mojolicious::Plugin::CGI accessory which will allow you to execute CGI scripts unchanged during your migration
Note however that all of the frameworks that you mention, as well as several others, will have their proponents. That is why you must make the selection yourself, as such recommendations will be influenced primarily by familiarity, and without your own knowledge of the requirements of your project
Unfortunately I cannot speak to the security issues of the various options, but I hope that has helped a little

Is MatLab worth buying? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I can access MatLab on school computers, but it would be more like a convenience factor as of right now. I want to get into programming using raspberry pi later on, but is it worth buying in the meantime? Will it be useful to me as a computer engineer? Thanks.
I have used Matlab as a student and employee for over 10 years now. I have recently taken an interest in Python as a free open-source alternative to Matlab and have been extremely impressed. Matlab is a very powerful and convenient tool, but has a significant cost, especially if toolboxes are needed. Python seems to cover all the same capability needs that I have in Matlab (with toolboxes), and if I ever need help doing something in python that I know how to do in matlab, I just do a quick google search and 9 times out of 10 I end up on this website, taking advantage of the questions that others have already answered.
With your question on Raspberry pi, it can actually run python code on board, but not the case for matlab.
I am not a computer engineer, but am of the opinion that python would likely benefit you more than matlab in the end as it is free, more widely used and can be used on devices such as raspberry pi. For reference, I have degrees in physics and electrical engineering and spend a great deal of time at work building optical sensors, operating them, and processing their data.
One more note: I like the Anaconda distribution of python, highly recommended

PLC Programming Best Practices [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I have recently inherited a PLC project. We are using Automation Direct PLCs and using the C-more software for writing ladder logic.
C-more allows me to add rungs for "Execute on every scan", "Execute when called", etc.
It also allows me to break out separate sections under each of these headings to attempt some organization.
Are there some agreed upon best practices for structuring ladder logic programs? I'm trying to bring some sanity to the development process.
Document as you go. Logic, elements, memory map, etc. Document for "the other person", even if that person is YOU. PLCs and their programs tend to have a LONG life, so you will be glad 1 year, 5 years or even 20 years down the road when you have to tweak/debug that PLC. You'll be glad you explained things in a little more detail by documenting it for "the other person".
Do NOT wait until "the end" to document. Yes, that implies that you need to keep the documentation up-to-date.
There are no established norms in the PLC programming realm, I've been developing, commissioning, maintaining (and reverse-engineering) PLC programs for 26 years. Many organizations develop in-house standards, but there are no accepted industry-wide standards. However, a method I gleaned from an old pro dictates placing decision-making rungs first (evaluating conditions and setting flags), making control decisions in the next segment, turning outputs on/off in the next section, and monitoring performance/upset conditions in the last.
It's based on how older machines evaluated I/O and handled ladder execution. The advent of ladder 'sub-routines' has helped enormously; I generally treat each motor as a 'sub-system' element and assign its' own sub-routine.
Hope this helps!

How to write a WOL app for iPhone? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Wake on LAN so cool, just want to write a iPhone app to WOL my PC, but have no idea to code, any one can point me the way?
If you've no experience of programming, then this is a very large first step. (More of a sheer vertical incline really.)
As such, you might want to take a step back and have a look a some basic (or indeed BASIC) programming tutorials. (Google is your friend.)
Alternatively, Apple has good online documentation regarding Objective C and the Cocoa (the language and framework that iPhone applications are written in.) A good place to start for this would be Apple's Introduction to The Objective-C Programming Language.
Basically you need to send a magic packed as described here, to do that you'll need basic programming knowledge and some knowledge on socket programming, here is a good book on the subject. There are numerous examples of that.
But in the end perhaps I could persuade you to purchase one of several iPhone applications that do exactly that, or grab the free one?
You'll need an understanding of bsd sockets as well as the user interface kit framework to put the necessary controls on the screen.
Or of course download an existing free app like this one which does it already, automatically detects your mac address, and also tells you whether your machines are on or off:
http://itunes.apple.com/us/app/wake/id396566137?mt=8
All the best for your projects.