New answers tagged

0

PB3 etc don't refer to Arduino pins. Instead they refer to the bits in the internal registers. To use digitalWrite() etc you must use Arduino pins not internal register bit numbers. The pin to port/bit mapping is defined by what board you have selected, and if you want to look it up you should examine the pins_arduino.h file for your selected board.


0

Almost certainly not Compilers often optimise switch statements using jump tables. However the entries in the jump table basically make up a lookup table with 214 entries! So you don't gain anything. Some ideas for compression You can use bit packing If your numbers aren't 8 bits in size, you can pack them together. For example, if you have managed to ...


1

214 is 16384 entries. Each entry takes 2 bytes. That's 32768 bytes. That's all the flash the ATMega328P has. The most efficient storage will be an array in flash, and that will take 100% of it. Using a switch will take more space. So in short: no. Just no. It won't work whatever you try. You need to come up with a radically different storage solution (...


2

Only need 4, or 5 pins; SCK (D13), MOSI (D11), slave select (D10). Maybe PWM (D9) for brightness. D12 not used, but is tied up as part of SPI bus. Connect the Anodes to +5. Connect the cathodes, with a current limit resistor per cathode, to the outputs of 4 TPIC6C595, or TPIC6B595. For the resistor, assume worst case voltage drop of 2V and 20mA current ...


0

You actually only need 12 pins for that display. The display is made up of 4 separate common anode LED displays, and you can use that to your advantage. Since the 4 anode clusters are separate you have the ability to switch an entire digit on or off. And as a result all the cathodes of the segments can be commoned together (that is, the cathodes of all the ...


0

As Juraj mentioned, you can use shift registers, such as 74HC595 which uses the SPI protocol. To elaborate slightly on this: You can cascade 4 shift registers, totaling 32 pins for output If you need 36, you can use the remaining 4 as normal pins (this is probably the easiest solution) Or you can use the Chip/Slave Select feature of SPI to control two ...


0

If I read the schematics at https://spellfoundry.com/download/sleepy-pi-2-usb-c-schematic/ correctly, you need to draw continuous 5V power from the SUPPLY_5V pin instead of the SUPPLY_EXP_5V pin (the latter seems to be switched via some MOSFETs connected to pin 2 of the ATMEGA328p). Which means that you need to connect the 5V power of your second HAT to JP4 ...


2

So, the comments went to chat. Somebody recommended to use decoupling caps as close as possible near the VCC/GND of Atmega. I have 10uF in my workbench, so I used on of these caps and the issue was solved.


Top 50 recent answers are included