Playduino
Playduino
  • 92
  • 136 046
(AM2303) DHT22 sensor tutorial - DHT22 vs. ntc thermistor - (Arduino Uno Programming for Beginners)
(AM2303) DHT22 sensor tutorial - DHT22 vs. ntc thermistor - (Arduino Uno Programming for Beginners)
In this video I connect a DHT22 (also called AM2303) to my Arduino Uno in order to measure temperature and humidity. I will also compare the results to my NTC temperature sensor from the last video.
มุมมอง: 92

วีดีโอ

Temperature measurements using Arduino - NTC thermistor - (Arduino Uno Programming for Beginners)
มุมมอง 14316 ชั่วโมงที่ผ่านมา
Temperature measurements using Arduino - NTC thermistor - (Arduino Uno Programming for Beginners) In this video I will show you how to use an measure the temperature using an NTC and a resistor divider connected to my Arduino Uno R3. I will calculate the ntc voltage, current, resistance as well as the temperature in the end.
brightness measurement - how to use an LDR on Arduino Uno using a voltage divider and analogRead
มุมมอง 13414 วันที่ผ่านมา
brightness measurement - how to use an LDR on Arduino Uno using a voltage divider and analogRead (Arduino Uno Programming Basics) In this video I show you how you can measure the brightness using an LDR connected to the analog input pin of an Arduino Uno R3. I use this information to turn on an LED based on the surrounding brightness.
DIY infrared transmitter (Arduino Uno Programming Basics)
มุมมอง 22121 วันที่ผ่านมา
DIY infrared transmitter (Arduino Uno Programming Basics) In this Video I show you how to drive a 100mA infrared diode using an Arduino Uno R3. I am using a transistor amplifier circuit and explain every component selection in detail. I also show you how you can use multiple resistors to match a desired value. In the end I use the setup to control both ONKYO AV Receiver and BENQ Beamer with the...
Receive remote control signals with TSOP 31240! (Arduino Uno Programming for Beginners)
มุมมอง 22028 วันที่ผ่านมา
Receive remote control signals with TSOP 31240! (Arduino Uno Programming for Beginners) In this tutorial, I demonstrate how to connect a TSOP 31240 IR receiver to an Arduino Uno and control an LED using various remote controls. 🔴 In this video, you will learn: How to wire the TSOP 31240 to an Arduino Uno. How to use an Apple Remote, Onkyo remote, and Benq remote to send signals to your Arduino....
How I will build my own DIY smart home sensor Part 1 - (Arduino Uno Programming for Beginners)
มุมมอง 188หลายเดือนก่อน
How I will build my own DIY smart home sensor Part 1 - (Arduino Uno Programming for Beginners) In this video, I'll guide you through the creation of a smart home sensor system to be mounted on the ceiling in every room of our house. Intro: While there are many smart home solutions on the market, I opted for a fully open-source, DIY approach to maintain complete control over our home and ensure ...
refactoring my ugly code - (Arduino Uno Programming for Beginners)
มุมมอง 170หลายเดือนก่อน
refactoring my ugly code - (Arduino Uno Programming for Beginners) In this video I will refactor my ugly moving head code. I will use constants, I will use functions and I will also increase the recoding time.
How to record moving head movements using arrays - (Arduino Uno Programming for Beginners)
มุมมอง 293หลายเดือนก่อน
How to record moving head movements using arrays - (Arduino Uno Programming for Beginners) In this video I show you how you can use a joystick to control a moving head that consists of two servos. I will also show you how you can record and playback movements using arrays
Servo motor vs normal motor - (Arduino Uno Programming for Beginners)
มุมมอง 288หลายเดือนก่อน
Servo motor vs normal motor - (Arduino Uno Programming for Beginners) In this video I show you the differences between servo motors and dc-motors and how to control them using an Arduino Uno.
arduino eeprom read and write - (Arduino Uno Programming for Beginners)
มุมมอง 3072 หลายเดือนก่อน
arduino eeprom read and write - (Arduino Uno Programming for Beginners) In this video I show you how you can use the internal EEPROM to save data that needs to persist.
What are Libraries? - install arduino library - (Arduino Uno Programming for Beginners)
มุมมอง 2752 หลายเดือนก่อน
What are Libraries? - install arduino library - (Arduino Uno Programming for Beginners) In this video I show you different methods to install Libraries in Arduino IDE and I will use timerOne to demonstrate interrupt() noInterrupt()
return statement - return NAN - (Arduino Uno Programming for Beginners)
มุมมอง 2902 หลายเดือนก่อน
return statement - return NAN - (Arduino Uno Programming for Beginners) In this video I show you what a return statement is and how we can make use of a special value called NAN.
#define vs const - symbolic constants or constant variables? (Arduino Uno Programming for Beginners)
มุมมอง 3442 หลายเดือนก่อน
#define vs const - symbolic constants or constant variables? (Arduino Uno Programming for Beginners) In this video I will talk about the differences between symbolic constants and const variables
What exactly happens when you press "Upload"? (Arduino Uno Programming for Beginners)
มุมมอง 3012 หลายเดือนก่อน
What exactly happens when you press "Upload"? (Arduino Uno Programming for Beginners)
#define symbolic constants (Arduino Uno Programming for Beginners)
มุมมอง 3473 หลายเดือนก่อน
#define symbolic constants (Arduino Uno Programming for Beginners)
What are Arduino functions? (Arduino Uno Programming for Beginners)
มุมมอง 4503 หลายเดือนก่อน
What are Arduino functions? (Arduino Uno Programming for Beginners)
How you send data from your computer to your Arduino - (Arduino Uno Programming for Beginners)
มุมมอง 5313 หลายเดือนก่อน
How you send data from your computer to your Arduino - (Arduino Uno Programming for Beginners)
arduino direct input register access: (Arduino Uno Programming for Beginners)
มุมมอง 2873 หลายเดือนก่อน
arduino direct input register access: (Arduino Uno Programming for Beginners)
Direct output manipulation, Switch case , 7 segment display: (Arduino Uno Programming for Beginners)
มุมมอง 5094 หลายเดือนก่อน
Direct output manipulation, Switch case , 7 segment display: (Arduino Uno Programming for Beginners)
Arduino random numbers! - (Arduino Uno Programming for Beginners)
มุมมอง 6424 หลายเดือนก่อน
Arduino random numbers! - (Arduino Uno Programming for Beginners)
I was wrong about millis: how to write non blocking code: (Arduino Uno Programming for Beginners)
มุมมอง 2.9K4 หลายเดือนก่อน
I was wrong about millis: how to write non blocking code: (Arduino Uno Programming for Beginners)
Smooth analog write using an RC-filter - (Arduino Uno Programming for Beginners)
มุมมอง 1.8K4 หลายเดือนก่อน
Smooth analog write using an RC-filter - (Arduino Uno Programming for Beginners)
Arduino data types - (Arduino Uno Programming for Beginners)
มุมมอง 3735 หลายเดือนก่อน
Arduino data types - (Arduino Uno Programming for Beginners)
Same name variable? - (Arduino Uno Programming for Beginners)
มุมมอง 5095 หลายเดือนก่อน
Same name variable? - (Arduino Uno Programming for Beginners)
What is global Scope? - (Arduino Uno Programming for Beginners)
มุมมอง 5345 หลายเดือนก่อน
What is global Scope? - (Arduino Uno Programming for Beginners)
Are self made paper soldering stencils any good?
มุมมอง 765 หลายเดือนก่อน
Are self made paper soldering stencils any good?
What are external Interrupts? - (Arduino Uno Programming for Beginners)
มุมมอง 3.5K5 หลายเดือนก่อน
What are external Interrupts? - (Arduino Uno Programming for Beginners)
analog output arduino - (Arduino Uno Programming for Beginners)
มุมมอง 2.8K6 หลายเดือนก่อน
analog output arduino - (Arduino Uno Programming for Beginners)
analog read input arduino - analogRead - (Arduino Uno Programming for Beginners)
มุมมอง 6876 หลายเดือนก่อน
analog read input arduino - analogRead - (Arduino Uno Programming for Beginners)
For loops arduino - (Arduino Uno Programming for Beginners)
มุมมอง 1.6K6 หลายเดือนก่อน
For loops arduino - (Arduino Uno Programming for Beginners)

ความคิดเห็น

  • @BoogarTheTinkerer
    @BoogarTheTinkerer 15 ชั่วโมงที่ผ่านมา

    Hey man, loved the video. Just wondering, where did u learn how to code? I’m wanting to get into electrical and mechanical engineering and I’m wondering where I learn to code things like lights, audio, motors, etc. What kind of coding would that be called? Thanks 🤘

    • @playduino
      @playduino 9 ชั่วโมงที่ผ่านมา

      Hey thank you. Arduino is great for interacting with electronics of all sorts so if you learn to code Arduino, it will help you a lot on your journey. I learned it in School, in the University and tinkering around at home :)

  • @310765
    @310765 7 วันที่ผ่านมา

    That’s amazing 🤩

  • @lastchance045
    @lastchance045 7 วันที่ผ่านมา

    i fully admire your math skills! Would like to see a practical application - turn on a object (pump, fan, motor)

  • @bob_mosavo
    @bob_mosavo 14 วันที่ผ่านมา

    Thanks 👍

  • @Volker-Dirr
    @Volker-Dirr 14 วันที่ผ่านมา

    Nice content. Even if it is a simple circuit. It would be better for a beginner if the circuit could be seen larger at time stamp 0:50. Maybe even a drawn circuit diagram. (Don't forget that maybe not all guys saw you previous videos.)

    • @playduino
      @playduino 14 วันที่ผ่านมา

      True 😅

  • @bob_mosavo
    @bob_mosavo 21 วันที่ผ่านมา

    Thanks 👍 I'd put a 1Meg pull down resistor from the base to ground 😉

    • @playduino
      @playduino 20 วันที่ผ่านมา

      It wouldn’t hurt for sure but will it help? When using mosfets you will need this resistor to keep the gate from floating when Arduino is in a high impedance state. The NPN needs a base current to become conducting, so the additional resistor should not be required.

    • @bob_mosavo
      @bob_mosavo 20 วันที่ผ่านมา

      @@playduino Even a BJT is a voltage controlled device. If you don't believe me, just read The Art of Electronics and/or the Ebers-Moll equations. It's much easier to use the calculation approximations for current with BJTs, which is why almost everyone thinks BJTs are current controlled. Also, why didn't you choose to go with an emitter follower circuit? I think the calculations could have been much easier, and I believe you would not have to use specific items from a BJT data sheet. Anyway, that's just my two cents 😉

    • @playduino
      @playduino 20 วันที่ผ่านมา

      thank you for sharing your thoughts but I am not convinced, yet 😅 I looked into Art of Electronics Third Edition. On page 76 you find the circuit that I used to drive an LED.

    • @bob_mosavo
      @bob_mosavo 20 วันที่ผ่านมา

      @@playduino Please take a look at the video titled "BJTs are VOLTAGE-Controlled Current Sources!" on the channel "Lantertronics - Aaron Lanterman" I think that may help convince you 😉

    • @playduino
      @playduino 20 วันที่ผ่านมา

      Thank you for sharing the video 🙂 It's an interesting approach to think about the BJT as a voltage controlled device. And it seems accurate. However even if there was a high source impedance voltage on the base that is high enough, it would immediately break down due to the "leakage" current of the transistor into the base. So I still do not see why this resistor should be required. 😅

  • @brandonclayton5479
    @brandonclayton5479 21 วันที่ผ่านมา

    Didn't work for me on my M3 Pro. Here is the error message below fork/exec /Users/XXXXXXXXX/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++: bad CPU type in executable Compilation error: fork/exec /Users/XXXXX/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++: bad CPU type in executable

    • @playduino
      @playduino 21 วันที่ผ่านมา

      hi, make sure to download the Apple Silicon Version

  • @jimg9294
    @jimg9294 21 วันที่ผ่านมา

    Excellent! Thank you.

  • @jimg9294
    @jimg9294 28 วันที่ผ่านมา

    Awesome!

  • @310765
    @310765 28 วันที่ผ่านมา

    Awesome 🤩

  • @Volker-Dirr
    @Volker-Dirr หลายเดือนก่อน

    Very nice video. For German guys who want to know more about the memory usage: In the magazin "c't make 3/24" (released 31.05.2024) it is described very detailed on page 92 to page 97. (If you wonder why I wrote this already 3 days before the release: I have a subscription of that paper and got it earlier).

    • @playduino
      @playduino หลายเดือนก่อน

      Thank you for sharing

  • @dboyd462
    @dboyd462 หลายเดือนก่อน

    What about using mmWave sensors? I've not played with them but they seem to have some good utility. I think it would also be good to leave access to a couple of pins for optional future add-ons in case you find a need for an additional specific use case. You could probably use ESP Home for this project as well, but that defeats the point of teaching a coding project I suppose 🤷‍♂️ Maybe make both versions for fun 🤔

    • @playduino
      @playduino หลายเดือนก่อน

      thanks for your thoughts! mmWave are very interresting, however I have to admit I would not feel comfortable knowing that these sensors constantly radiate 80GHz in every room 24/7. ESPHome looks like it would fit this project perfectly. With as many sensors as I would like to integrate, ESP32 might be a good choice (instead of using ATmegas). If I decide to pick ESP32, I might use POE to power everything and use ethernet for communication. I could still use Arduino IDE instead of ESPHome for teaching 🤔

  • @Volker-Dirr
    @Volker-Dirr หลายเดือนก่อน

    Nice. Maybe also simple switches, to check if a door or window is still open. Maybe a ultra sonic sensor to measure the distance (It just flashed my mind, because it is added in many Arduino kits.) Maybe use it to measure the amount of something (I have not good idea yet, maybe if there is still enough water in a rain barrel). Maybe a sensor to measure if you need to water your plants.

    • @playduino
      @playduino หลายเดือนก่อน

      Thank you for the feedback :) I think I forgot to mention that I will mount this sensor to the ceiling in every room :) but simple switches are a very good idea. I think I will add one multi-purpose button and one reset button, just in case

  • @KW-ei3pi
    @KW-ei3pi หลายเดือนก่อน

    Interesting project. This "recording" concept could be a very valuable asset for many Arduino/Servo/Stepper projects. However, I just couldn't follow or understand it for two reasons. First, your videos have a "trial and error" format, which is very good for learning why code does or doesn't work. But is can be hard to follow. Second, the video covered several things and the "recording" part really needs to be a separate video. And I just couldn't understand what was being recorded. Was it the time the servo was "on"? Could this work for Stepper motors by recording the number of pulses sent to the motor? If memory is a problem, how can you get around that? Or does the insufficient amount of memory make this impractical for most projects. Thanks

    • @playduino
      @playduino หลายเดือนก่อน

      thank you for the feedback. I agree, it is a little bit much for one video. I'm afraid I was too enthusiastic :D if you have not already, please check out my second video about this project, I go through the code again and refactor it so that it looks nice, I also fixed some bugs: th-cam.com/video/ACn4-3X8LvY/w-d-xo.html I record the angles of the servo every 10ms in both x and y axis, I also record if the light should be on or off at any given moment of the recording. for example the start of xServoValues array could look like this: [90, 90, 90, 91, 91 , 92, 92, 93 ,94 , 95 ,96 ...] when I playback, I loop through this values. I set the servo to xServoValues[0] which is 90, after 10ms I set it to xServoValues[1] and I do this again and again until I reach the end of the array. yes this could also be used with stepper motors. you can increase the time between measurements. in theory you could even interpolate between measurements to make it smooth again but this will only work if up to a certain limit. the best way would be to use external memory or a microcontroller with more memory

    • @KW-ei3pi
      @KW-ei3pi หลายเดือนก่อน

      @@playduino Thanks for the reply. It helps and I appreciate it very much. So, my request is, please make some videos that address the things we talked about here. 😀 Also, I would like to send you pictures of my project, if you have a "junk" email address that you don't mind posting here. I'm hoping that you will be able to be successful in your TH-cam endeavors and will be able to post more projects. Thanks again. Regards

    • @playduino
      @playduino หลายเดือนก่อน

      feel free to send me some infos / pictures: youtube@playduino.com

    • @KW-ei3pi
      @KW-ei3pi หลายเดือนก่อน

      @@playduino Thanks. I sent an email last week. Did you receive it okay?

    • @playduino
      @playduino หลายเดือนก่อน

      @@KW-ei3pi Hi, yes I just answered.

  • @playduino
    @playduino หลายเดือนก่อน

    you can find the code here: github.com/playduino/arduino-uno-programming/tree/main/30_moving_head_refactored/moving_head_refactored

  • @alexmoore8740
    @alexmoore8740 หลายเดือนก่อน

    Is there a way to set the pullup resistor to read 0 initially till switch is pressed

    • @playduino
      @playduino หลายเดือนก่อน

      On Arduino Uno R3 there are only Pull-Up resistors which means they pull the signal HIGH (1) so the switch has to be connected to GND and will result in 0 when pressed

  • @310765
    @310765 หลายเดือนก่อน

    Wow! Beautiful 🤩

    • @playduino
      @playduino หลายเดือนก่อน

      Thank you 😊

  • @Volker-Dirr
    @Volker-Dirr หลายเดือนก่อน

    I must think about it a bit, but at least 2 points should be done. The 2 points that you already explained in other videos: a) using const variables instead of using the numbers 5, 6, ... 200. b) what about bouncing if you press a button? Can't that be critical if you record? So you record and because of the bouncing it might override the just done record by a very short new unwanted record? A third point is maybe: c) write a shorter main loop and call functions for 2 (sub)-tasks. A function that cares about the movement and a function that cares about the record. (maybe a bit over engineering, since you main function is (maybe) still short enough, but it is a good point to teach how to read the x and y value once and use them in the functions. You also probably want to make the project bigger and then it is fine to separate that 2 things.)

    • @playduino
      @playduino หลายเดือนก่อน

      thank you very much for the detailed suggestions. I will use them in the next video :)

  • @bob_mosavo
    @bob_mosavo หลายเดือนก่อน

    Thanks 👍

  • @playduino
    @playduino หลายเดือนก่อน

    you can find the ugly but working code here: github.com/playduino/arduino-uno-programming/tree/main/29_moving_head/moving_head

  • @jimg9294
    @jimg9294 หลายเดือนก่อน

    Thank you!

  • @peterkarlsson7801
    @peterkarlsson7801 หลายเดือนก่อน

    Thanks for a good video! digtalWrite take some time to execute. Even if the time is very short, it can affect your "homemade" PWM signal.

    • @playduino
      @playduino หลายเดือนก่อน

      thank you! yes this is true, digitalWrite is slow, if you need fast IO, you better directly work with the registers - however in this case the problem was delayMicroseconds(): the largest value supported is 16383 🥲

  • @MattC2085
    @MattC2085 หลายเดือนก่อน

    I’m a noob but Could it be that if you were saying less than 180 you were only making it to 179?

    • @playduino
      @playduino หลายเดือนก่อน

      😂 you are correct, sorry for the confusion . The thing is, 1.5ms should be 90 degrees, but in my case it was more like 110. so the maximum input in my case would be maybe maybe 145 degrees which then results in 180 real degrees

    • @MattC2085
      @MattC2085 หลายเดือนก่อน

      Ok, now you lost me. I’ll have to let that sink in.

  • @Volker-Dirr
    @Volker-Dirr หลายเดือนก่อน

    With the new UNO R4 the limit is already 8mA.

    • @playduino
      @playduino หลายเดือนก่อน

      Wow, so you can‘t even drive a standard LED 😳

  • @bob_mosavo
    @bob_mosavo หลายเดือนก่อน

    @playduino Your bug is that delayMicroseconds() cannot take the large numbers you are giving it. The manual states: "Currently, the largest value that will produce an accurate delay is 16383; larger values can produce an extremely short delay. This could change in future Arduino releases. For delays longer than a few thousand microseconds, you should use delay() instead." For example, 19000 > 16383. Also, do yourself a favor and cease using "unsigned int", etc. Instead, include stdint.h and use uint32_t and its relatives. That way you will know EXACTLY how many bytes your variable is implemented with when you switch from one architecture to another or from one complier to another 😉 For instance, an "unsigned int" may be implemented by a word, which may be 16 bits on the 8-bit AVR and 32 bits on an ARM Cortex-M4.

    • @playduino
      @playduino หลายเดือนก่อน

      wow thank you for pointing this out. I was not aware of this delayMicroseconds() limitation! I agree that using types like uint32_t is safer, however with beginners in mind I will keep using the simple data types. I try to avoid everything that would have scared me away as a beginner back in the days 😅

  • @310765
    @310765 หลายเดือนก่อน

    Awesome 🤩

  • @bob_mosavo
    @bob_mosavo หลายเดือนก่อน

    Thanks 👍

  • @Volker-Dirr
    @Volker-Dirr 2 หลายเดือนก่อน

    Very nice video.

  • @310765
    @310765 2 หลายเดือนก่อน

    Brilliant 🤩 👍🏼

  • @hukeo1522
    @hukeo1522 2 หลายเดือนก่อน

    perfekt habe es endlich verstanden danke dir

  • @neilnagel9857
    @neilnagel9857 2 หลายเดือนก่อน

    I would like to see more videos about libraries and how to utilize them. Oftentimes I look for a library to help with a project but can't figure out how to use it. I would love to see a channel that has a video that focuses on one specific library at a time and explains in detail on how to use it. It's probably beginner stuff but I get lost easily.

  • @Volker-Dirr
    @Volker-Dirr 2 หลายเดือนก่อน

    Nice video. I don't know if all libraries in the library manager have got a license similar to MIT (like visible in the last seconds of this video) or BSD. If there are also other licenses like GPL, ... then it is maybe useful to do a small video about the topic licenses.

    • @playduino
      @playduino 2 หลายเดือนก่อน

      Thank you! Interesting topic indeed, I will look into it.

  • @DRUMsetINkeyboard
    @DRUMsetINkeyboard 2 หลายเดือนก่อน

    im the 1000 subscriber :)

    • @playduino
      @playduino 2 หลายเดือนก่อน

      well done =D

  • @310765
    @310765 2 หลายเดือนก่อน

    Hi Playduino ‘If (true)’ if ‘what’ is true? Thanks 😊

    • @playduino
      @playduino 2 หลายเดือนก่อน

      if (true) is always to, so whatever is written inside the {} is always executed. You will not find this in a normal program because it makes no sense, I just used it to create a different scope :)

  • @cadillacescalade5428
    @cadillacescalade5428 2 หลายเดือนก่อน

    Hi, I have 2 blocking coded that both have delay I have a servo code that goes from 30 to 60 and from 60 to 30 with a delay of (15) speed back an forth. And also a DF-Mini player that has delays.. I'm not to familiar with Arduino so am needing some assistance

    • @playduino
      @playduino 2 หลายเดือนก่อน

      Hi, instead of delay(15) you could use the code shown in this video and then handle the servos instead of blinking the led (what I did)

    • @cadillacescalade5428
      @cadillacescalade5428 2 หลายเดือนก่อน

      @@playduino would you still have the code ?

    • @playduino
      @playduino 2 หลายเดือนก่อน

      Hi the thing is, I do not know exactly what you are trying to do. However I think in your case the simplest solution is actually to use a library called TimerOne. You can keep your working blocking DF-Mini code in the loop. And then have a timer isr function called every 15ms. Inside you change the angle of the servo. You will need two static volatile global variables, one for current angle (int) and one for the direction(bool). Inside or the isr you increment the angle if direction true and decrement the angle is the direction is false. If you hit the maximum angle you need to change direction to false. If you hit the minimum angle you need to change direction to true. Put all this logic into ISR, but don’t put a delay into the ISR. You do not need it, because the ISR is called every 15ms. I’ll upload a video about TimerOne soon. But if you look at example code I’m sure you can do it

    • @cadillacescalade5428
      @cadillacescalade5428 2 หลายเดือนก่อน

      @playduino HI well what I am trying to put together is a sketch for a wig-wag (sweep servo) using a IR sensor and a DF-Mini player.

  • @Volker-Dirr
    @Volker-Dirr 2 หลายเดือนก่อน

    I prefer to write the error message already in the function (So before "return NAN"), because... a) ... by that you only need to write it once. (Since functions are often used more than only once). b) ... you might do an other calculation that results into NAN and then your error message is "wrong", since the reason is not because of dividing by 0. Maybe the first argument was already NAN or ...

    • @playduino
      @playduino 2 หลายเดือนก่อน

      I agree, thank you for sharing :)

  • @navassherif3839
    @navassherif3839 2 หลายเดือนก่อน

    Awesome teacher

  • @robertbauer6723
    @robertbauer6723 2 หลายเดือนก่อน

    I thought that using symbolic constants versus constant variables would affect the size of the compiled output. So I did a test comparing #define and "const int." The compiled sketch in both cases used the same number of bytes. So I am left with only what you said; using symbolic constants can lead to difficulties when debugging. That is very good to know. Thank you.

    • @playduino
      @playduino 2 หลายเดือนก่อน

      Thank you for the feedback! I think the compiler optimizes both versions to the same result all the time.

  • @Volker-Dirr
    @Volker-Dirr 2 หลายเดือนก่อน

    I am also not 100% sure about 1:47. I think technically it is not unclear. (But I agree that probably not all coders know, so it is difficult to read and I also prefer to see the type.) From the arduino reference about integers "By default, an integer constant is treated as an int with the attendant limitations in values. To specify an integer constant with another data type, follow it with 'u', 'U', 'l', 'L', 'ul' or 'UL' ".

  • @Volker-Dirr
    @Volker-Dirr 2 หลายเดือนก่อน

    I didn't tried it yet, but in the arduino languarge reference in chapter "#define" they wrote "This can have some unwanted side effects though, if for example, a constant name that had been #defined is included in some other constant or variable name. In that case the text would be replaced by the #defined number (or text)."

  • @KW-ei3pi
    @KW-ei3pi 3 หลายเดือนก่อน

    I've been enjoying your videos. You do and excellent job of teaching Arduino programing. A common use for Arduino boards is running code for Stepper Drivers/Motors. Will you be getting into that as well as using Switches, Buttons, Potentiometers, and Rotary Encoders, etc., or are you just going to focus on Functions and other aspects of programing? There are a lot of videos that demonstrate the use of Arduino programing with LED's. This is a good way to demonstrate it, but I would like to see more practical examples. The kind of things that Arduinos are actually used for. For example, I am working on converting an industrial milling machine's manual controls into power feeds, using three Arduinos running three Stepper Drivers/Motors, each with forward and reverse switches, potentiometers for speed control, rotary encoders for fine feed, and buttons or joysticks for jogging and rapid feeding, as well as limit switches and warning indicator LED's. Regards.

    • @playduino
      @playduino 3 หลายเดือนก่อน

      thank you for the nice feedback and sharing your project. I already covered potentiometers in this video: th-cam.com/video/t7TW546GS3E/w-d-xo.html I also used a button + debouncing in the dice project th-cam.com/video/rmQqDoofxSI/w-d-xo.html my videos are intended for beginners. So in order to cover stepper motors + drivers I will have to cover a lot of other topics first. I might eventually get there but I cannot tell you how long it will take

    • @KW-ei3pi
      @KW-ei3pi 3 หลายเดือนก่อน

      @@playduinoThanks for the reply. I'm going back to watch your previous. I look forward to all of you future videos. I'll share a programing problem that I'm trying to solve, as it might give you ideas for a future video. I'm using a Potentiometer to set the speed of my Stepper motors. Using the map function to convert the Pot reading to a number that is passed to delayMicroseconds, between HIGH and LOW sent to the Driver. Stepper motors don't like to start at a high speed, but rather need to "ramp up" to higher speeds. So I'm trying to take the mapped number and if it is a number below 300 (a short delay) use a "for" loop to pass a higher number (500) and then a progressively lower number to the delay till it reaches the mapped number from the Pot. I've had some success, but am not there yet. I'm using one variable to contain the number from the "for" loop, but I may have to use more than one. I think I will get there, but my code will likely be long and inefficient. If you enjoy coding, you like solving problems. This one is quite challenging. Regards.

    • @playduino
      @playduino 3 หลายเดือนก่อน

      this would make a great video! let's see who is faster :D please let me know when you found a solution that works for you

    • @KW-ei3pi
      @KW-ei3pi 3 หลายเดือนก่อน

      @@playduino This simple code seems to work and demonstrates the concept without all the hardware: int pd; //Pulse Delay int myDelay; //Ramp up Delay void setup() { Serial.begin(9600); pd=300; myDelay = 500; } void loop() { if (pd < myDelay){ for(myDelay = 500; myDelay > pd; myDelay = myDelay -1){ Serial.println(myDelay); delayMicroseconds(12000); } } else myDelay = pd; Serial.println(myDelay); delayMicroseconds(myDelay); }

    • @KW-ei3pi
      @KW-ei3pi หลายเดือนก่อน

      @@playduino Hey. How are you doing? I thought that you were going to come up with some code to accelerate a stepper motor. ??? I have been working on it for a month and still haven't come up with working code. I've eliminated the potentiometer and just have a button to start the motor, accelerate from a set low speed to a set top speed, then stop when I release the button. Achieving acceleration is not to difficult, but achieving linear acceleration is difficult. Thanks. Regards.

  • @jimg9294
    @jimg9294 3 หลายเดือนก่อน

    That was an awesome explanation! Thank you.

  • @lastchance045
    @lastchance045 3 หลายเดือนก่อน

    Enjoyed your video and like the provision of the code on github. Maybe a suggestion for other videos - reduce the "screen space" for "output" - the black area under the lines of code . This would allow for viewing of 5 or so lines more - which would give a better overall view of the sketch as you speak.

    • @playduino
      @playduino 3 หลายเดือนก่อน

      Thank you, good idea

  • @310765
    @310765 3 หลายเดือนก่อน

    Just found out pin A0 on Arduino R4 has analogue output. very interesting and so cool 😎 👍🏼

  • @jimg9294
    @jimg9294 3 หลายเดือนก่อน

    Thank you for the video. 👍

  • @matthiasberndt7897
    @matthiasberndt7897 3 หลายเดือนก่อน

    Bad advice, don't do this. Use an enum instead. enum Color { GREEN = 9, YELLOW = 10, RED = 11 }; - It allows you to use the constant when evaluating expressions in a debugger - It respects the usual scoping rules of the C language while #define doesn't (e. g. you can declare a local variable called GREEN inside a function - using a #define will break that) - It leads to better error messages Another alternative with similar benefits is to just declare these as `static const int GREEN = 9;` etc.

    • @playduino
      @playduino 3 หลายเดือนก่อน

      Thank you very much for sharing!

  • @bob_mosavo
    @bob_mosavo 3 หลายเดือนก่อน

    The "break;" that was inside the manipulateLED() function would not exit the switch block inside the loop() function.

    • @playduino
      @playduino 3 หลายเดือนก่อน

      I had a very bad feeling about the break inside the function 😂 thank you for the clarification

  • @bob_mosavo
    @bob_mosavo 3 หลายเดือนก่อน

    #define GREEN 9 int GREEN = 9; ARE NOT SIMILAR. "#define GREEN 9" defines a macro "GREEN" and "int GREEN = 9;" defines and initializes a global variable "GREEN" 🙃

    • @playduino
      @playduino 3 หลายเดือนก่อน

      you are absolutely correct, after rewatching my video, I have to admit that my words are very misleading.

  • @Volker-Dirr
    @Volker-Dirr 3 หลายเดือนก่อน

    Most of the video is nice. But I am not sure about using define here. I think just using "const" is a better coding style in this case.

    • @playduino
      @playduino 3 หลายเดือนก่อน

      Thank you for the feedback! Can you tell us more about when you would use const and when you would use #define? I‘m always thankful to learn more.

    • @Volker-Dirr
      @Volker-Dirr 3 หลายเดือนก่อน

      @@playduino Well, I am not an Arduino coder. I am c++ coder. Maybe it is different here. I always use define only, if i can't code it different (for example if i want to code different lines for different CPUs or operating systems). It helps reading the source if you have a lot of defines that are used for other stuff than just doing a const. Not sure if there are also other advantages, I must rethink about it. In the arduino reference about "const" they also wrote in the notes/warnings section: "In general const is preferred over #define for defining constants." So if you don't know why you are using #define instead of const, then const if the better variant.

    • @playduino
      @playduino 3 หลายเดือนก่อน

      fair point, thank you very much for sharing@@Volker-Dirr

    • @matthiasberndt7897
      @matthiasberndt7897 3 หลายเดือนก่อน

      #define should be used only when necessary, e. g. if you plan to later use #if or #ifdef with that definition.

    • @janboerschlein
      @janboerschlein 2 หลายเดือนก่อน

      @@playduino define just copies whatever you have defined to the areas where you used it, a variable will actually be stored in memory and then be passed to the function or whatever you are doing with it. So if you define a pin for example and then use that lets say 3 times, the pin number will actually be copied 3 times in you code. If it's a variable it will only be there once. #define is mostly used for example for debugging where if you use #if or #ifdef that code will not be compiled and will free up memory on the arduino if the condition doesn't meet up.

  • @Volker-Dirr
    @Volker-Dirr 3 หลายเดือนก่อน

    Nice video.