LESSON 34: Return a Variable Value from a Function in Arduino

  Рет қаралды 41,839

Paul McWhorter

Paul McWhorter

Күн бұрын

Пікірлер: 101
@naboulsikhalid7763
@naboulsikhalid7763 2 жыл бұрын
I went back to this video again, to not to understand but to make sure that I got it right. I made my own examples and It works. this a turning point of understanding the essence of modular programming. it's a hallmark for me thanks to YOU. God bless you with health and serenity.
@ynnebbenny
@ynnebbenny 2 жыл бұрын
Thanks Paul, I really appreciate your videos.
@gediminasgresevicius2901
@gediminasgresevicius2901 5 жыл бұрын
Can't wait for your next video. Keep on moving with function. You are so good in explanations.
@MrJcspar
@MrJcspar 6 жыл бұрын
You are a Great teacher Paul! Thanks for this series as well as your others.
@GarretsonIndustries
@GarretsonIndustries 7 ай бұрын
Great video. Literally so helpful. I've watched more hours of you than most other youtubers and the other ones are just entertainment
@michaelcostello6991
@michaelcostello6991 4 жыл бұрын
As usual a very easily understood lecture. Where i work no one shares knowledge so it is always very refreshing to sit down and watch one of your lectures. Thanks
@danthemancasey
@danthemancasey 6 жыл бұрын
Another great video! Thank you, always look forward to your uploads!
@TheGremlinsParadise
@TheGremlinsParadise 5 жыл бұрын
Watched many videos on functions. This guy explain it THE BEST way you can imagine. Great owrk Paul, love this video, finally understand it !
@erygion
@erygion 5 жыл бұрын
Great lesson Mr. Mcwhorter, I've learned a lot and you explain it well. I look forward to future lessons. Thank you. ♾
@sajidnaseeb5386
@sajidnaseeb5386 6 жыл бұрын
u r a life saver man!!!!plzzz upload your lecture regularly as humanly as possible!!! Thank you soo much man!!!!
@krishath7085
@krishath7085 4 жыл бұрын
Thank you for taking the time to do for all your videos. They are great.
@kw4nx
@kw4nx 5 жыл бұрын
Thanks for being so animated and enthusiastic!!! It really helps me to better capture the knowledge.
@MrChrisiscool15
@MrChrisiscool15 3 жыл бұрын
Such a great video and an even better teacher. Thank you
@NathanEnos2005
@NathanEnos2005 6 жыл бұрын
Great video! I've been trying for several years to learn the Arduino, watching this video and that video, reading articles, and nothing ever fell together. When I started watching this series a few months ago, something finally clicked. I'm no expert yet, but I'm actually making progress! Thank you! P.S. I did catch the mistake (returning x instead of answer). If only I could catch my own mistakes like that! :D
@Chupria
@Chupria 3 жыл бұрын
You're Arduino lessons get the most views from the entire portfolio. I think a sequel to the NEW Arduino lessons would make for some great television this upcoming winter. Just imagine "Small microcontroller...big flavor!"
@clairsmyers3571
@clairsmyers3571 5 жыл бұрын
Excellent video. Thank you Paul! It explains a lot!
@michaelhawthorne8696
@michaelhawthorne8696 4 жыл бұрын
Certainly clearer, thanks Paul. I wasn't aware of making the function Variable_Type () { when passing said Variable to the function. No wonder I was having some problems with local variable errors.
@ashwinpavithran8976
@ashwinpavithran8976 4 жыл бұрын
Clear explanation, I like your videos.
@adammiller6451
@adammiller6451 3 жыл бұрын
Thanks, was looking everywhere trying figure out how to pass a variable from loop to another function
@rianvankessel1767
@rianvankessel1767 11 ай бұрын
Learned a lot, thanks for the clear explanation.
@lundebc
@lundebc 6 жыл бұрын
I just ran across thesetutorials,they are very well done, and extremely informative.
@JoseAntonio-wt3zm
@JoseAntonio-wt3zm 4 жыл бұрын
Excellent lessons on functions ! Thank you !
@steveseabrook7659
@steveseabrook7659 2 жыл бұрын
This is really helpful thank you and very well explained. Thank you.
@abhijithekv
@abhijithekv 2 жыл бұрын
Thank you, kind sir. This is absolutely excellent!
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
Glad you enjoyed it!
@kennyvandersypt8465
@kennyvandersypt8465 6 жыл бұрын
Each video brings solutions to my projects problems! Loving this :) Didn't know anything about coding last week. Not saying i'm a guru now, but now i'm able to somewhat read existing code and use it for my own.
@kenblanch4178
@kenblanch4178 6 жыл бұрын
Great video I was struggling with using function now I understand where I was going wrong.
@Steve-GM0HUU
@Steve-GM0HUU 3 жыл бұрын
All making sense, thank you. That second example is useful. You can throw any float variable called x into that x_squared function from another function and it will throw the answer back.
@paulmcwhorter
@paulmcwhorter 3 жыл бұрын
Excellent!
@ShinesMonkey1
@ShinesMonkey1 4 жыл бұрын
Some of the best stuff I have learned!!
@rickm4130
@rickm4130 6 жыл бұрын
Thanks for another great video! Looking forward to #35
@Experts_top_5
@Experts_top_5 4 жыл бұрын
thanks a lot sir, this tutorial helped me to design my own (tech pendant technique) for robotic arm using an Arduino.. i have been trying for this a couple of weeks, finally got an efficient way... thanks
@peterbaylis8631
@peterbaylis8631 4 жыл бұрын
Excellent tutorial Paul, thanks ..
@michaelpadovani9566
@michaelpadovani9566 6 жыл бұрын
EXCELLENT selection of topics, thank you!
@stever3886
@stever3886 4 жыл бұрын
Great video, learned a lot. I would LOVE to see a summary slide of all the details of this video and future videos. Like where does a new function go in the code structure......ALWAYS at the bottom......see that stuck when you said it. Like the low level explanation but would like to see some jargon in there like “scope”.....why is x in the void loop different.....because of function scope. Analogy would be looking through a beverage straw close up to your hand, you can only see a finger, not the whole hand.....scope is similar since the local variables only see the variables in that local function.
@jabber2824
@jabber2824 8 ай бұрын
Great lesson! thank you.
@woodchurchler84
@woodchurchler84 6 жыл бұрын
Thank you very much for your great lessons! Love your content... Kind regards from Germany
@subhashsharma3463
@subhashsharma3463 6 жыл бұрын
Excellent video sir I was struggling with these THANK YOU
@LemonTreeNOTfree
@LemonTreeNOTfree 2 жыл бұрын
void setup() { Serial.begin (9600); } void loop() { float x; float x2; Serial.println("What number do you want to square? "); while (Serial.available()==0){ } x =Serial.parseFloat(); x2=x_squared(x); Serial.print(x); Serial.print("squared is equal to"); Serial.println(x2); } float x_squared(float x ){ float answer; answer = x*x; return answer; }
@Amr.Khateeb
@Amr.Khateeb 6 жыл бұрын
Thank sit ,you can also talk about passing multiple variables from the void loop to to the functions , and for returning values functions only return one value , so we can use another C language method to return multiple values.
@Prompt24
@Prompt24 6 жыл бұрын
777 views and 70 likes. Very nice. By the way Paul is the only person whom I listen on the Normal Speed not to miss anything.
@ericthered9655
@ericthered9655 4 жыл бұрын
Very helpful. Hoping you cover passing arrays in the next video.
@xzyte_kun7560
@xzyte_kun7560 3 жыл бұрын
Best as ever!!
@mechsparks
@mechsparks 5 жыл бұрын
Wonderful video
@Amitshendage
@Amitshendage 4 жыл бұрын
Thank you sir ...i can understand your explanation very easily ...it helps me a lot for my project..
@light4163
@light4163 4 жыл бұрын
Thank you for your time!!
@Reach41
@Reach41 6 жыл бұрын
Thanks again for another great leseon.
@adrianobarbosa-buenosaires2789
@adrianobarbosa-buenosaires2789 6 жыл бұрын
Everything make sense... tanxs so much
@madalinduna4160
@madalinduna4160 4 жыл бұрын
just another great lesson :)
@chrisgosling6810
@chrisgosling6810 2 жыл бұрын
Hello Paul, could these older "Orange shirt" set be made available as a classic Arduino set as well as the new "Gold shirt" videos. This particular video and 32 & 33 are just what I needed as I have a bad case of "code writers block". Going through these videos helps unblock. Invaluable as always!
@sanjayg786
@sanjayg786 5 жыл бұрын
Excellent ....
@ashenafib.4314
@ashenafib.4314 6 жыл бұрын
Good lesson, thank you very much.
@ntokozohlatshwayo165
@ntokozohlatshwayo165 3 жыл бұрын
best teacher
@santoshkawale21
@santoshkawale21 6 жыл бұрын
thanks Paul for great video.....just try to finish coffee till end of lecture😂😂
@paulmcwhorter
@paulmcwhorter 6 жыл бұрын
You know, my coffee machine just broke, so I am very sad.
@waynewelshans1172
@waynewelshans1172 6 жыл бұрын
Thank you for another very helpful video. how would you go about sending and or receiving multiple variables to a function? if it is possible I'll bet that was already your plan for the next lesson LOL.
@patelsanket3518
@patelsanket3518 6 жыл бұрын
Thanks for every video
@naboulsikhalid7763
@naboulsikhalid7763 2 жыл бұрын
thank you, thank you. I got i now(passing variables).
@tobitezea8825
@tobitezea8825 2 жыл бұрын
Nice paul.i thank u so much
@tobitezea8825
@tobitezea8825 2 жыл бұрын
Please how I get ur Mail address I have some problem in I will like to share with u please
@dahlendo7513
@dahlendo7513 6 жыл бұрын
I love your videos, Please make video series on Esp8266 (Generic or Node mcu), Serial Communication from Java or C# to Arduino, DC and Stepper motors
@Bob-zg2zf
@Bob-zg2zf 6 жыл бұрын
One problem for me to follow this tutorial lessons is that Sparkfun is native to America, thus it is kind of difficult for a non-North Americans to collect all the modules/gear that we could use together with the Arduino board. For instance, I had a hard time to procure the colour sensor in China. As a result, I had to skip some lessons in this tutorials and jump into these later ones which do not use thoe modules. Other than that, the tutorial is PERFECT!!!
@gteich04
@gteich04 6 жыл бұрын
Thanks Paul!
@opalprestonshirley1700
@opalprestonshirley1700 6 жыл бұрын
You remind me of my Professors. Great video. Keep up the good work.
@loptica62
@loptica62 6 жыл бұрын
Lucky you... (actually I'm a bit envious - thumbs down).... But I think that no one comes close to Prof. Paul.... and... I don't think it's just good work - FYI it's nothing less than GREAT WORK
@Haamedtm
@Haamedtm 5 жыл бұрын
Mr.McWhorter please make another lesson about "switch, case" and state machines. thanks.
@ismzaxxon
@ismzaxxon 6 жыл бұрын
Thanks Paul :)
@chawlamohali
@chawlamohali 6 жыл бұрын
lifesaver! thank you!
@paulbarrett1372
@paulbarrett1372 4 жыл бұрын
Hi Paul, excellent lesson!! do you think you could do one with the function out side the Arduino IDE, using a Header file and CPP file and how to build that in the Arduino IDE ??
@paulbarrett1372
@paulbarrett1372 4 жыл бұрын
Sorry I figured it out, on the upper right you can click new tab and name the files with a .h and .cpp extension.
@shivamkapoor1827
@shivamkapoor1827 6 жыл бұрын
Sir also make videos series on pic, AVR, ARM microcontrollers
@vishalpaul5268
@vishalpaul5268 6 жыл бұрын
sir thank you so much for your uploads on arduino programing lessons sir sometime in future if possible make a lesson explaining arduino code for 8x8x8 led cube
@G-REV_CHUCK
@G-REV_CHUCK 3 жыл бұрын
Please do a tutorial on RFID reader. I am having trouble understanding and have nobody to turn to.
@khalidabdulrazak3322
@khalidabdulrazak3322 5 жыл бұрын
Hi Paul, amazing tutorials. It will be highly appreciated if you can help me with my SD card file issue, I need to create a new file to store new data instead of losing the previous data by overwriting. e.g when start sensor the program create file 1, then when switched off then switched on I need the program to create file 2 instead of writing on the same file 1.
@jeffvenqueleir2036
@jeffvenqueleir2036 6 жыл бұрын
i ws looking for this stuff and i have a good teacher now i no what to do this winter i am 88 years old
@paulmcwhorter
@paulmcwhorter 6 жыл бұрын
Congratulations on being a life long learner. Keep it up!
@AVyt28
@AVyt28 6 жыл бұрын
I am looking forward to tutorials on spi ,i2c communications, learning to read data sheets, atmega 328 programming....
@amazagx
@amazagx 2 жыл бұрын
👏👏👏
@quaternion-pi
@quaternion-pi 6 жыл бұрын
Love your tutorials. In function definition avGrades() you return average and then continue the function definition with bucket = 0; Doesn't 'return' terminate a function so that bucket=0; will not be executed? Thanks for your sharing your expertise. I could be mistaken as I mix up javascript, python, and arduino C in my head.
@raztabraze
@raztabraze 2 жыл бұрын
I too think that the return terminates the function, but Paul hasn't repeat the input of grades so we couldn't see that issues on the average
@williamkennedy3837
@williamkennedy3837 11 ай бұрын
I've been beating my head against a brick wall for a while on this problem, I haven't tested it yet, but it passes the smell test. Basic programming uses the command "gosub", I've got a hint for arduino, simpler is better.
@subhashsharma3463
@subhashsharma3463 6 жыл бұрын
Will you go for using keypads (4*4) I had made a door lock with that but facing some problem while changing the password without connecting to a computer . Help Me Sir , if you can find sime time for keypads because i know you are busy with your stuff but if you can then please do it . Again thanks for sharing your excellent knowledge
@reveriechristine476
@reveriechristine476 5 жыл бұрын
THANK YOU VERY MUCH
@ptprabhu
@ptprabhu 4 жыл бұрын
I'm here after completing Arduino new tutorials and Robotics 18 tutorials..
@cjet8905
@cjet8905 6 жыл бұрын
great video but something has been very wrong with the audio in the last 2 videos, very cracky sounding and i cant turn it up enough to hear you :/ thanks for the great videos, keep them coming!
@misterdroidma
@misterdroidma 5 жыл бұрын
Thank a lot for your video lessons they are great I have a question for you . I have a lot of difficulties to parse values from this function to an other one . I need those int root in an other function Alarme to compare hour and mn received with esp8266 time clock system void firebasedata(){ Firebase.stream("/Alarme/", [](FirebaseStream stream) { //String eventType = stream.getEvent(); //Serial.println(eventType); //String data = stream.getDataString(); //Serial.println(data); const size_t capacity = JSON_ARRAY_SIZE(6) + 5*JSON_OBJECT_SIZE(3) + 130; DynamicJsonBuffer jsonBuffer(capacity); ////StaticJsonBuffer jsonBuffer; ////char json[] =stream.getDataString(); JsonArray& root = jsonBuffer.parseArray(stream.getDataString()); ////root.add(null); ////if(!JsonArray& root.success()) { ////ESP.restart(); ////} JsonObject& root_1 = root[1]; int root_1_H1 = root_1["H1"]; // 9 int root_1_Mn1 = root_1["Mn1"]; // 6 int root_1_scID1 = root_1["scID1"]; // 1 // JsonObject& root_2 = root[2]; int root_2_H2 = root_2["H2"]; // 14 int root_2_Mn2 = root_2["Mn2"]; // 11 int root_2_scID2 = root_2["scID2"]; // 2 JsonObject& root_3 = root[3]; int root_3_H3 = root_3["H3"]; // 14 int root_3_Mn3 = root_3["Mn3"]; // 11 int root_3_scID3 = root_3["scID3"]; // 2
@yogi9219
@yogi9219 6 жыл бұрын
BOOM==brilliant.
@ShamboNaskar
@ShamboNaskar 5 жыл бұрын
Hello sir, please make a tutorial on how to establish communication between two Arduino. I really need this🙏🙏🙏
@Steve-GM0HUU
@Steve-GM0HUU 3 жыл бұрын
Did you ever find out how to do this?
@ErkanOkman
@ErkanOkman 6 жыл бұрын
👏👍
@SatishKumar-yn8tr
@SatishKumar-yn8tr 2 жыл бұрын
how to return multiple values. please help
@papaalphaoscar5537
@papaalphaoscar5537 6 жыл бұрын
My averages keeps on compounding the result from previous calculations and I can not figure it out. Code is the same as far as I can tell.
@karamyounis15
@karamyounis15 4 жыл бұрын
you have to set your bucket = 0 at the end of the void loop so that it resets the average calculation.
@welders485
@welders485 5 жыл бұрын
Yea I need to know how to pass strings and files. I'm trying to use a Bluetooth, to ask an sdcard, for a file, one of 320 files , with very long names, and get back from the file ,2 usable servo numbers ,servoA and servoB, from the sdfile of my choice. Sound complicated ? Yes it is . I could be years away from building this code.
@maryamsalama4267
@maryamsalama4267 6 жыл бұрын
what if i want two return two variables?
@knarftrakiul3881
@knarftrakiul3881 6 жыл бұрын
That is a dark cup of coffee paul lol
@keithryant5779
@keithryant5779 6 жыл бұрын
Why not create a new tab? Then all you have to do is import to your next project and call it in your main (loop).
@rohit-lohar
@rohit-lohar 6 жыл бұрын
plesase explain it by simple example
@ledc131
@ledc131 3 жыл бұрын
Open my eyes.
LESSON 31: Understanding Arduino Arrays
29:47
Paul McWhorter
Рет қаралды 70 М.
I shouldn't be in the house  It's so embarrassing
00:22
Funny Parent-Child Videos
Рет қаралды 8 МЛН
Control a Stepper Motor with Hall Effect Switches
28:13
DroneBot Workshop
Рет қаралды 250 М.
LESSON 32: Understanding Arduino Functions
26:45
Paul McWhorter
Рет қаралды 66 М.
Using EEPROM with Arduino - Internal & External
31:54
DroneBot Workshop
Рет қаралды 203 М.
I Spent 100 Hours Inside The Pyramids!
21:43
MrBeast
Рет қаралды 76 МЛН
How to Use Arduino Interrupts The Easy Way
33:28
Rachel De Barros
Рет қаралды 99 М.
Functions won’t eat arrays whole - Do this simple thing instead!
8:10
Programming Electronics Academy
Рет қаралды 13 М.
Controlling DC Motors with the L298N H Bridge and Arduino
36:41
DroneBot Workshop
Рет қаралды 1,3 МЛН