Direct output manipulation, Switch case , 7 segment display: (Arduino Uno Programming for Beginners)

Поделиться
HTML-код
  • Опубликовано: 6 июл 2024
  • Direct output manipulation, Switch case , 7 segment display: (Arduino Uno Programming for Beginners)
    In this video I show you how to directly manipulate the output registers of Atmega328P to drive a seven segment display. I also make use of the switch - case control structure.
    0:00 intro
    0:22 datasheet / hardware
    1:45 hardware test
    5:10 output registers
    9:30 switch case
    13:35 exercise

Комментарии • 3

  • @jimg9294
    @jimg9294 4 месяца назад

    Thank you!

  • @Volker-Dirr
    @Volker-Dirr 4 месяца назад

    Very nice video. Good questions.
    About the first (indirect) question: Why the LED are off if they are set to HIGH. I don't know, but maybe 2 reasons: If there is an error like a disconnected wire, it is (sometimes) easier to see/locate/find the bug. Or it is maybe easier/cheaper to build it that way?
    About the second question (missing breaks in switch): If you use code checkers in c++ like cppcheck, then they also recommend/warn to always use break. But sometimes I don't add breaks too. For example if a user can increase the number of features by a slider. So if you write it like in your code you might for example select "1" to enable all features. While selecting the "2" you don't enable the first feature, only feature 2 to 6. So you don't need to repeat every feature that will be enabled. You only need to add every feature a single time. So the user won't have a lot of checkboxes to enable/disable every single feature. The user can only use a slider/number and enable/disable features with a single value.

    • @playduino
      @playduino  4 месяца назад +1

      Thank you :)
      I think the main reason why the LEDs are usually common anode is that Sink drivers (switching to GND) are usually cheaper and better then source drivers (switching to supply voltage).
      Thank you for your explanation this makes sense, I guess having a little bit more breaks is often more efficient than code duplication.