arduino direct input register access: (Arduino Uno Programming for Beginners)

Поделиться
HTML-код
  • Опубликовано: 2 окт 2024
  • arduino direct input register access: (Arduino Uno Programming for Beginners)
    In this video I will directly access the input register and show you how to use bit masks and bitwise operators to manipulate specific bits without changing other bits. I will also complete the dice project

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

  • @AlexHerman-qj3pi
    @AlexHerman-qj3pi 7 месяцев назад +1

    More. I wanna more !

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

    Nice. You might even tell about (shortcut) compound operators %= and |=.
    I am not 100% sure about the "improved" randomness. I think with that variant it is now "only" depending on the "release time" (or the milli second before releasing) of the button. The randomness is in fact independent from the "start time" and/or "duration".

    • @playduino
      @playduino  7 месяцев назад

      yes ! I totally forgot about them :/
      hmmm ... yeah I think you are correct. The better way might be to calculate the random seed only once (first button press for example). then the randomness should be dependent on the button down and button up time

    • @the_hetman
      @the_hetman 7 месяцев назад

      You could put a noise generator circuit on an analog input and sample the noise at the start of the program to generate the seed.

    • @playduino
      @playduino  7 месяцев назад

      @the_hetman interesting idea, however you should do a lot of samples and combine them to get more than 10bits of randomness

    • @the_hetman
      @the_hetman 7 месяцев назад

      Yes, my idea would be to take a large number of samples and find the average (taking the median would be better but that would require a lot of RAM), then I would use that average value as a threshold and take further noise samples, one for each bit in the seed, setting the bit if the sample is above the threshold, otherwise clearing the bit. That way you would build up a full seed.
      I’m planning on creating a noise generator with a reverse bias transistor. I might need to amplify it to get a good range of values.

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

      @@the_hetman hmm... Why taking a lot of samples and find the median? Shouldn't it be enough to just take 32 samples and then only take the lowest bit of a noise generator samples and use them as one (out of the 32) bit(s) of the seed?