6

i=i++; //increment by one The result of the above statement is not defined. That is, it is not necessarily "i + 1". See: http://en.wikipedia.org/wiki/Sequence_point http://c-faq.com/expr/seqpoints.html Instead use: i++; Or: i = i + 1; A note about "undefined behavior": http://en.wikipedia.org/wiki/...


5

2.9V doesn't sound too bad. See a datasheet for the CR2032 I found: It looks like slightly more than 2.9V would be the expected voltage for up to 600 hours. 3.2V looks like it is fully charged, and won't stay at that level for long. Having said that, 200 µA current sounds like a lot. You should be able to get it down to 6 µA. Perhaps post your schematic? ...


5

The ATtiny85 has a built-in delay counter that keeps the MCU in reset mode for some time after the power is applied. This seems to be intended as a wait for the clock and power to be stabilized. The length of this delay depends on your selected clock source, and is somewhat configurable with the fuses. According to your code, your MCU is clocked at 8 ...


4

!flip doesn't really do anything and will probably be optimized out by the compiler. You need to save the result: flip = !flip; You can simplify the code a bit: void loop() { if(flip) { servo.write(60); } else { servo.write(100); } flip = !flip; delay(650); } Or, get rid of the delay altogether: uint32_t ...


4

I think you have the wrong end of the stick here. The Attiny85 is not a chip that comes in different speed versions. The datasheet mentions that it can run at 20 MHz. That doesn't mean you can buy a "20 MHz version". By selecting the appropriate clock option in fuses you can run at 20 MHz (or higher). From the datasheet: High Frequency PLL Clock ...


3

What you want is a P-channel MOSFET to control the power. Something with a nice low "logic level" gate threshold. simulate this circuit – Schematic created using CircuitLab R1 keeps it switched off. Set the output to LOW to pull the gate down and enable the MOSFET. Be sure to "stop" your Serial connection and set both TX and RX pins to INPUT to ...


3

I had problems too - SHORT: all about USB-hub or PC's root-hub and extension cables +Luck. My ebay items were going under the name "Digispark Kickstarter ATTINY85 Arduino Micro USB Development Board" and naturally it came with no Digispark-(c)-right infringing markings from China. I kept my fingers crossed that my items would at least be AVRisp-programable....


3

You may use DigiCDC to virtually create a serial device. It's slow but does the job as mentioned in this article. A serial-echo program would look something like this: #include <DigiCDC.h> void setup() { SerialUSB.begin(); } // the loop routine runs over and over again forever: void loop() { if (SerialUSB.available()) { SerialUSB.write(...


3

As @majenko wrote, the I2C bus was not designed to go over wires or into a cable. It is ment for components on the same pcb board. As @mikaelpatel wrote there are bus drives which convert the I2C signal into some kind of RS-485 signal for twisted pair cables. The crosstalk between SDA and SCL should be avoided at all times. Don't put SDA and SCL into wires ...


3

If you have 1 receive only device, and 2 send-only devices, why not make the receive-only device the master, but have it poll (periodically, repeatedly ask) the slave devices to send any data they have pending. That way, there is only one master, and it only asks for data when it's ready (that is, not receiving from some other device.) One purpose of a ...


3

It can be done. Your Digispark has SPI pins, which are ISP pins. For the esp8266 there is an ESP8266AVRISP library for OTA upload to AVR. You can use the example of the library. You must wire the SPI pins and ground together. Wire reset pin of Digispark to io 5 (D1) of NodeMcu. You should use level conversion, but esp8266 tolerates 5 V TTL (not recommended ...


3

The old circuit will not work as you expect. While the ATtiny85 can run happily with 2.7 to 5.5V in this setup it expects 5V. I assume this is due to the high CPU clock setting. To run stable at a high CPU clock it requires 4.5V. The VIN pin is connected to a linear regulator that has a 2V drop-out. Thus the supplied voltage has to be at least 2V about the ...


3

Digisparks are known to have problems with USB3 ports (which your USB-C adaptor probably provides). Try using a cheap USB2 hub between the DigiSpark and the adaptor. It's always a good idea to use a cheap USB hub between whatever experimental device you want to connect and your machine, so that if you wire something up incorrectly you don't end up frying an ...


3

Expanding on my previous comment... I need a way to keep an array of memory ignored by the C initializer You can achieve this by instructing the compiler to store the array in the “.noinit” memory section: int my_array[ARRAY_LENGTH] __attribute__((section(".noinit"))); Your array will end up sitting somewhere between the .bss and the heap (if any), and ...


3

The answer to the main problem was that I had used pinMode(mode, number) where the actual syntax is pinMode(number, mode). Presumably modes can be selected by number and the compiler though I wanted to set an undefined pin to mode number. TL;DR the correct syntax is pinMode(4, OUTPUT) to set PB4 (pin 3) to output. The problem of higher than expected ...


3

You already found your problem. I am answering only to provide some insight on why you were experiencing the symptoms you had. pinMode() takes two integer arguments (two uint8_t to be precise). The names INPUT, OUTPUT and INPUT_PULLUP are just macros for 0, 1 and 2 respectively. This is why the compiler accepts your code with the arguments swapped. On the ...


3

Port PB0 is not an ADC (analog input) pin on the ATTiny85. Available pins of the ATTiny85 (from the Atmel ATtiny 25, 45, 85 datasheet): Choose PB2, PB3, PB4 or PB5 if you need an analog input. Additional information: When built in TinkerCAD, using PB2 as an analog input does not seem to work correctly and produces a fixed value. Using PB3 did work correctly ...


3

From your AVRDude output: avrdude: safemode: Fuses OK (E:FF, H:DF, L:62) It does not appear that you have programmed the AVR configuration fuses. One for thing, E:FF, is extended fuse value 0xFF, which is missing the SELFPRGEN (self-programming) fuse that would allow Micronucleus to load your code onto the AVR, that is allow the AVR to execute instructions ...


3

If you look at the Digispark Schematic you'll see resistors and Zener diodes attached to XTAL1 and XTAL2: These are for the USB D+ and D- signals that the Digispark bit-bangs. I deeply suspect that the crystal is just not going to resonate with these parts connected. To get back to a working Digispark you'll probably have to inject signal onto XTAL1 again ...


3

There is no such Digispark board as the Rev 3. There was going to be, but there was a mistake, so they went straight from Rev 2 to Rev 4. However unscrupulous Chinese counterfeiters are making "Rev 3" boards. So... your mileage may vary since the components used on there could be of any dubious quality. But to your problem: P5 is also the RESET pin....


3

As an addition to Majenko's answer I can report having used many of the "Rev.3" counterfeits, every single one came with chip default fuses thereby reset enabled. You can set the RSTDISBL fuse with your Arduino, plus update the micronucleus bootloader in the process (freeing 0.4k). Keep in mind setting this fuse will disable ISP programming, so you ...


3

You can write, at the end of loop(), “if one minute has elapsed, then go to sleep”. In C++, that would be: if (millis() >= 60000) // 60 seconds elapsed sleep_mode(); You will need to include <avr/sleep.h> in order to have access to the sleep_mode() function. The sleep is likely to be very short though, probably less than a millisecond, as the ...


3

FastLED needs to keep the colors of all the pixel in RAM, so that is using a lot of RAM. To get around this, you could use a strategy that generates the pixel data on the fly as you send it out to the strings. Here is an example of a project that does that... https://wp.josh.com/2021/04/21/build-a-live-scrolling-tickertape/ Also, SoftSerial keeps a buffer (...


2

I have no idea why they haven't used a fixed pull-up, but the pull-up is only done when the controller wants to read the sensor for only about 120us. If you want to get a good resolution in the resistance measurement, the resistance of your pull-up should be in the same range as the resistance of your sensor. If your sensors have low resistance, this ...


2

The servo can't move back and forward in 40 milliseconds. It'll be more like tremble between both. Try something like this: // keep sending 0 position for about 400ms for(int i = 0; i<20; ++i) { digitalWrite(PB1, HIGH); delayMicroseconds(1000); digitalWrite(PB1, LOW); delay(19); } // keep sending second position for about 400ms for(int i = 0; i&...


2

Try replacing the lines #define DATA_1 (PORTC |= 0X01) // DATA 1 // for UNO #define DATA_0 (PORTC &= 0XFE) // DATA 0 // for UNO #define STRIP_PINOUT (DDRC=0xFF) // for UNO int buttonPin = 11; //button pin variable, 11 on the Arduino with #define DATA_1 (PORTB |= 0X01) // DATA 1 // on PB0 #define DATA_0 (PORTB &= 0XFE) //...


2

I want to transmit I2C data... A little vague. Transmit to what device? How fast is your data rate (100kHz, 400kHz)? Your only transmitting and not reading anything back? What is the idling voltage of your I2C bus (to then ask if you have chosen correct pull-up resistor values for your intended bus speed)? You mention that the Wire library doesn't ...


2

This is normal. Timer0 is used as the clock source for the USI. It's the only internal clock source that can be used. The only other option is to use "software polled" mode where it's up to the sketch (or support library) to manually create the clock signal (less than desirable) by setting a bit in a register at the right time. So you can only use Timer1 ...


2

THIS IS NOT AN ANSWER; it's just a very long comment and I was not able to add all the formatting and ideas in the comment I was writing. Please don't consider it as a valid answer. I leave all the low current topics to Nick, since he's doing a great work as usual. I wanted just to give you some ideas for the temperature acquisition and storing. First of ...


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