Notifications
Clear all

Information overload

34 Posts
4 Users
2 Likes
1,108 Views
(@lhedrick9701)
Member
Joined: 9 months ago
Posts: 11
Topic starter  

 

I have been writhing C code for about 40 years but, retired out of software development back in 2002.

Having started on main frames in 1974, these little micro controllers have a bigger code base than million dollar mainframes did years ago.

So the syntax of a language, C, perl, python, whatever is a lot but it’s nothing compared to the endless header files and code libraries and now classes we need to build anything.

Being new to Arduino I now have another mountain to climb.   I know this is a vague question but is there a beginner FAQ or other place to start the learning process for all the basic libraries to get off the ground?

I hate to ask this type of question because I know the information is out there, its just a matter where we find it without hundreds of hours of open searching.  

 


   
Quote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2532
 

@lhedrick9701

For now, ignore the libraries and just start writing simple code to do simple things like abusing LEDs.

Libraries only become important when you start using communications and modules or devices that don't have a simple interface. then you can start using libraries to again get a simple interface to the device. Just read the .h file to see what methods are available and what parameters they need. You'll probably only need a couple (well, maybe a few) libraries for each sketch. Don't let the fact that there are thousands of libraries make you feel that you have up understand each one of them to start. In a couple of years you'll be cursing the fact that there isn't one for the device or comm system that you want 🙂

So, after you finish working with the base LEDs you can move on to temperature/humdiity sensors. Hall sensors and so on until you reach your desired level of component aggregation.

 

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6982
 

@lhedrick9701 Welcome to the micro world. I am similar to you. I started in 1959 and officially retired in 2004, but I still get calls to see if I am interested in this project or that. You don't need to 'learn' or memorize the libraries. They will present themselves when the need arises. What @will said is right on. I will add a couple things, check the attached pic and go through some of the built in examples. These are the very basic examples, after that comes examples for whatever board you have selected, then examples for any libraries you have selected. Have a look at Bills (dronebot) videos (there is an article with each one, check the more under the vid) and see what interests you. Eventually you will encounter one that uses a library and you will wonder why Bill chose that particular one. This is why they pay us the BIG bucks. It's art, luck, standing on the shoulders of others. One easy answer for you is to ask here on the forum. Let me give you a small example. If I want to work with a temperature/humidity sensor I can do a search on the built in Arduino libraries and get something like 100 hits. They will probably all work but there may be some gotchas. Starting with AdaFruit is always a safe approach and may be all you need. Experience and asking around is what you need. After that, there is the world of GitHub. That same temperature library will likely have hundreds more in GitHub. Do they all work, probably, does it matter which you use, probably not. Again, just ask if something goes wrong.

Sorry, no 'magic' answers.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@hilldweller)
Member
Joined: 1 year ago
Posts: 111
 

Posted by: @lhedrick9701
 

I have been writhing C code for about 40 years but, retired out of software development back in 2002.

Being new to Arduino I now have another mountain to climb.

You have no mountain to climb, you've already climbed it. The Arduino environment a stroll in the park.

 

// find the on board led pin

Take a cheap UNO ( because it comes with sockets ).

Stick LED in 5, other side via 1K to ground or +5.

#define ledPin 5

void setup()
{
Serial.begin(115200);
delay(1000);
Serial.println("\nLED Pin Test - Pin " + String(ledPin));
pinMode(ledPin, OUTPUT);
}

void loop()
{
digitalWrite(ledPin,LOW); // LED on
delay(500);
digitalWrite(ledPin,HIGH); // LED off
delay(500);
}

That's it. Good old C.

Now the real power of Arduino, think what you want to do and Google it. Everything you could ever do with Arduino has been done and is well documented. Not every hit is a good one but it will not take many minutes to find one that looks good.

 

I am a big fan of ESP32 because it's cheap, ridiculously powerful and has built in WiFi. So if you buy a cheap UNO format ESP32 board you are good to go the switch that LED from phone/tablet in about one screen of code.

The slight downside of the phone<-->ESP32 is you include some HTML.

 

 


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2532
 

@hilldweller 

If you're going to post code in the forum, please do it correctly so that it displays properly.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6982
 

@hilldweller Please clarify, one way the LED works, the other way it burns out.

Stick LED in 5, other side via 1K to ground or +5.

 

 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6982
 

@hilldweller In case you don't know how to post code, here is a screen grab showing you where the help is. Also, it helps us if you either follow one of the standard style guides or at least use the IDE/Tools/Auto Format. 

p.s. You could also use the built-in LED. See the Sample Blink sketch in the IDE under Basics.

Screenshot 2023 08 19 at 12.06.34

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@hilldweller)
Member
Joined: 1 year ago
Posts: 111
 

Posted by: @zander

p.s. You could also use the built-in LED. See the Sample Blink sketch in the IDE under Basics.

 

The problem being that the inbuilt LED is not consistent across Arduino boards. So telling him to use an external LED makes it easier.

Reverse biassing an LED at 5V will not destroy it. I was giving him the credit that he'd work out the correct way to connect it. That could be an error.

 


   
ReplyQuote
(@hilldweller)
Member
Joined: 1 year ago
Posts: 111
 

Posted by: @will

@hilldweller 

If you're going to post code in the forum, please do it correctly so that it displays properly.

Sorry, it's perfectly readable here, what goes wrong at your end ?

 


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2532
 

@hilldweller 

Bad formatting and hard to read because it has been converted to html and is treated like body text.

Here's an example of properly posted code  ...

https://forum.dronebotworkshop.com/esp32-esp8266/save-of-current-reading/#post-39477

By the way the constant LED_BUILTIN can be used as the pin number to access the onboard LED.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6982
 

@hilldweller Yes, a few boards don't have the BUILTIN but then the sample Blink sketch would do it differently.

I know I have popped a few LEDs by getting mixed up with what goes where, how do you not fry them? If that were true, there would be no need to mark them as Anode and Cathode. Am I confused or you?

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@hilldweller)
Member
Joined: 1 year ago
Posts: 111
 

Posted by: @will

@hilldweller 

Bad formatting and hard to read because it has been converted to html and is treated like body text.

You are hard to please.

I highlighted the code. Copy.

Open Arduino 2 - new.

Paste over empty sketch.

Compile. Perfect.

 

I have found, using a big assortment of cheap Arduino type boards that led built in sometimes fails.

 

You may have noticed, a couple of weeks ago I gave a bigger lump of code to a new member using a zip file.

 


   
ReplyQuote
(@hilldweller)
Member
Joined: 1 year ago
Posts: 111
 

Posted by: @zander

there would be no need to mark them as Anode and Cathode. Am I confused or you?

I must point the finger at you.

The marking on an LED is so that you insert them correctly. There is no light if connected in reverse.

But you will not kill an LED by connecting it to 5V the wrong way.

Of course you can kill an LED by connecting it to 5V the right way - if you omit the current limiting resistor.

 


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2532
 

@hilldweller 

Many of the forum members would rather see properly formatted code in postings. Having to copy it and then paste it into the IDE and then auto-format it so that it's properly displayed and indented is time wasted.

Most experienced members would not even bother looking at an unformatted sketch, you'll often see comments asking posters to post the code in proper format. 

But, do as you like, it's a free forum. If you don't want to give readers the easiest view of your sketch, it's your choice.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
(@lhedrick9701)
Member
Joined: 9 months ago
Posts: 11
Topic starter  

I guess as a beginner to this I just have a lot of questions like with anything new.

For example in a simple sketch (why a program in now called a sketch seems odd) which plays with LEDs I see things like

Serial. begin

Serial.print

Serial.println

pinMode

digitalWrite with parameters for the pin number and a range.

If I want to look at the digitalWrite class and see what all the methods and their parameters are where do I find them?   

I can see what they do in the sample code and look at the serial output but, if I were to change something and fall in a hole where would I go to look at classes/methods or functions to study them.

If I’m overthinking this just say so,   its a bad habit of mine. 

I don’t want to go too far with this but will add one other item.  I have not looked yet but can I assume we have basic debug ability, breakpoint, step in/over.  Variable inspection?  


   
ReplyQuote
Page 1 / 3