2

You can just normally use all pins except for the reset pin (pin 0). When you want to program the Attiny, you just connect the programmer. It will reset the Attiny through the reset pin and put it into ISP programming mode. At that point your code hasn't run. Note: If you want to program the Attiny while it still sits in its circuit, you have to be careful, ...


2

You call function num_Write a lot, you create a forward declaration: void num_Write(int); But you forgot to create the implementation. If you would have forgot the forward declaration the function would not be known at all (and you would get a compiler error). But with the forward declaration you let the compiler know the signature of num_write (so the ...


2

There are a couple things with your code which you might need to look into. Note: I'm doing this ontop of my head, so please correct me if I say something incorrect. ] First, to check if values are equal, with an if-statement you'd have to use: //if (trigPin_up, HIGH && trigPin_down, LOW); not like this. if (trigPin_up== HIGH && ...


2

You can use the bit shift and and operator, like: uint32_t data = 0xFFFF0001; The following line will shift all bits 15 places to the right, meaning the least significant 15 bits will be removed, and the other bits shifted to the right. uint32_t dataLeft = data >> 15; 11111111111111110000000000000001 >>>>>>>>>>>>&...


1

Here is an example of some code I used to read two encoders using pin change interrupts. This is possible to do with one ISR since they all share a common port. The key is it has to be short. As long as you can keep all 6 pins from your encoder on the same port, this should be easy to extend to 3 encoders. It might even work for four on one port. Or you ...


1

This line in the code: int colourArray[350]; // An array to hold RGB values ...contains 3 values for each LED. But 350 / 3 is 116.67. This value should likely have been 117 * 3 = 351 for the original code. And for the posted code using 188 LEDs this likely should be 188 * 3 = 546. This same problem of indexing into the colourArray repeats several ...


1

In the first case, the first time, that the outer if statement becomes true, the code will go into the while(1) loop and will be stuck there forever. The second code is different, since the while loop will check at each start of it's iteration, if the condition is still met. If not, it will exit, so not necessarily an infinite loop. Going into an infinite ...


1

The ATTiny chips commonly used in Arduino-like boards, such as the Adafruit Trinket or the Digispark USB will usually have a bootloader which runs before your own code. The bootloader checks for a certain state on the USB port of the board, to see if something is waiting to write a new program to the chip. The bootloader accepts new code from the host ...


1

The reason is that in your sketch you import only the header file (which is good). However, there it is an array (int[]), not the initialized array. For that you would need to include the cpp but that is bad practice (if even possible). So instead, create a new (constant) variable, and assign it. (more or less pseudo code, due to lack of a compiler): Lib....


Only top voted, non community-wiki answers of a minimum length are eligible