I'm willing to pay $200 (not commercial)

Ok, now I got ya. Here we call “driver” the entire schematics with microcontroller and everything, not just what you call led “driver”.

Without a specific cap for offtime, the method tterev3 mentions is your best bet. Timing can vary a little, but RAM in older generation ATtiny’s (13a/25/85) usually decay within a second or so. The newer series 1 don’t decay for ages even with 1uF input cap. My “no_init” RAM lasts over 10 minutes, I havn’t bothered testing further.

you can also use parts of Bistro HD OTSM code without an OTC
It has the MCU powered during off time in a low drain state from a 47uF capacitor

I can help you with hardware all the way from design, to prototyping and final production in small quantities
I am pretty familiar to use existing BLF firmware but I can’t program much mainly config the settings code

.

if you once tried Bistro HD OTSM you may consider rather modify it that writing something on your own

Can you provide an example of a more modern processor Mike C?

Try this. Not sure where your source came from - appears to have some Arduino-based I/O functions? Are you doing this in Atmel Studio with the compiler or in Arduino?

#include <avr/sleep.h>

#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif

//**here you set brightness of modes
int mode1 = 255;
int mode2 = 8;


const int ledPin = 0; // setting LED pin

unsigned int key __attribute__ ((section (".noinit")));

unsigned int mode __attribute__ ((section (".noinit")));

void setup() {
if(key==12345){ //check if RAM is still valid from last time
mode++; //yes, advance to next mode
if(mode>2) {mode=0;}
}
else{ //long power loss. default to first mode
mode=0; //default mode after long power off
key=12345; //initialize key for next power loss
}

pinMode(ledPin, OUTPUT); // Sets LED as output

sbi(GIMSK,PCIE); // Turn on Pin Change interrupt
sbi(PCMSK,PCINT1); // Which pins are affected by the interrupt
}

//mode one: LED is set to 100% brightness by default
int modeone() {
analogWrite(ledPin,mode1);
}

//mode two: LED is set to your preference of brightness (my default is about 30% = 76)
int modetwo() {
analogWrite(ledPin,mode2);
}

//mode three: strobe light, I set it to be the most disorienting in darkness but feel free to change on and off times (in [ms])
int modethree() {
digitalWrite(ledPin,HIGH);
delay(15);
digitalWrite(ledPin,LOW);
delay(100);
}


void loop() {

switch(mode){
default:
case 0:
modeone();
break;
case 1:
modetwo();
break;
case 2:
modethree();
break;
}
}
//loop end


void system_sleep() {
cbi(ADCSRA,ADEN); // Switch Analog to Digital converter OFF
set_sleep_mode(SLEEP_MODE_PWR_DOWN); // Set sleep mode
sleep_mode(); // System sleeps here
sbi(ADCSRA,ADEN); // Switch Analog to Digital converter ON
}

ISR(PCINT0_vect) {
}

Newbie here

What coding language is this?

Yes I am using Arduino IDE.

I’m using the ATtiny3217 for all of my own projects, ever since BLF user gchart paved the way with the 1-series: Adventures in TinyAVR 1-Series
I don’t know of anyone else here using the 1-series but I haven’t been keeping up much lately.

Also for what he is aiming of firmware functionality the 25 should be well enough space and connectivity
Maybe even the 13a is enough for ultra cheap build

there we have BLF firmware he can partially use or modify

C / C. So you’re thinking of starting with C?

BTW - There’s an ATTINY85 dev board that plugs directly into USB and is supported by Arduino. Unfortunately, the bootloader takes up ~2K of ROM.

Can someone refer to me more about this, what light is used and how to you “hook the light up to each voltage”? This is in the Bistro-tripledown code -

CALIBRATION
*
* To find out what values to use, flash the driver with battcheck.hex
* and hook the light up to each voltage you need a value for. This is
* much more reliable than attempting to calculate the values from a
* theoretical formula.
*
* Same for off-time capacitor values. Measure, don’t guess.
*/

The light that is used is the one you’re writing the firmware for! You hook the light up to one voltage at a time by connecting it to a regulated supply, and write out the ADC result for each voltage you care about.

you don’t need to do any voltage calibrations if the code you are using is the one you posted - it has no battery measurement functions in it

I’ve been working on this all week, can seem to get a working hex file. I’ve tried it in AVR Studio 7 and Arduino, no luck. In Arduino, I get errors that end with “#include nested too deeply”.

Can someone help me out with a hex file?

Trying to use Bistro HD firmware here [UPDATE:v1.7.1,Q8&1chanOTSM]bistro-HD, bistro your way. OTSM, eswitch(devel), Vcc reads, safe_presses, turbo timeout...

I thought you said the file you posted before was working to output the pwm you needed. Did you try the modified version I replied with?

tterev3 yes I tried it and couldn’t get it to compile in arduino. It did build in AVR Studio, but couldn’t get it to load due to signature differences (yes the correct chip ATtiny25 was selected.

I set the fuses to
Low: 0xd2
High: 0xde
Ext: 0xff

It threw a warning and I proceeded with programming the fuses, and it has bricked 4 chips so far. I’ve overnighted more chips so I should have them tomorrow.

What compile errors?

Arduino: 1.8.10 (Windows 10), Board: “ATtiny25/45/85, ATtiny25, Internal 1 MHz”

In file included from sketch\tk-delay.h:24:0,

from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:164:

tk-attiny.h:11:5: error: redefinition of ‘int mode1’

int mode1 = 255;

^

In file included from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:58:0:

sketch\tk-attiny.h:11:5: note: ‘int mode1’ previously defined here

int mode1 = 255;

^

In file included from sketch\tk-delay.h:24:0,

from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:164:

tk-attiny.h:12:5: error: redefinition of ‘int mode2’

int mode2 = 8;

^

In file included from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:58:0:

sketch\tk-attiny.h:12:5: note: ‘int mode2’ previously defined here

int mode2 = 8;

^

In file included from sketch\tk-delay.h:24:0,

from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:164:

tk-attiny.h:15:11: error: redefinition of ‘const int ledPin’

const int ledPin = 0; // setting LED pin

^~

In file included from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:58:0:

sketch\tk-attiny.h:15:11: note: ‘const int ledPin’ previously defined here

const int ledPin = 0; // setting LED pin

^~

In file included from sketch\tk-delay.h:24:0,

from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:164:

tk-attiny.h:17:54: error: redefinition of ‘unsigned int key’

unsigned int key attribute ((section (“.noinit”)));

^

In file included from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:58:0:

sketch\tk-attiny.h:17:14: note: ‘unsigned int key’ previously declared here

unsigned int key attribute ((section (“.noinit”)));

^

In file included from sketch\tk-delay.h:24:0,

from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:164:

tk-attiny.h:19:55: error: redefinition of ‘unsigned int mode’

unsigned int mode attribute ((section (“.noinit”)));

^

In file included from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:58:0:

sketch\tk-attiny.h:19:14: note: ‘unsigned int mode’ previously declared here

unsigned int mode attribute ((section (“.noinit”)));

^~

In file included from sketch\tk-delay.h:24:0,

from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:164:

sketch\tk-attiny.h: In function ‘void setup()’:

tk-attiny.h:21:6: error: redefinition of ‘void setup()’

void setup() {

^

In file included from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:58:0:

sketch\tk-attiny.h:21:6: note: ‘void setup()’ previously defined here

void setup() {

^

In file included from sketch\tk-delay.h:24:0,

from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:164:

sketch\tk-attiny.h: In function ‘int modeone()’:

tk-attiny.h:38:5: error: redefinition of ‘int modeone()’

int modeone() {

^

In file included from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:58:0:

sketch\tk-attiny.h:38:5: note: ‘int modeone()’ previously defined here

int modeone() {

^

In file included from sketch\tk-delay.h:24:0,

from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:164:

sketch\tk-attiny.h: In function ‘int modetwo()’:

tk-attiny.h:43:5: error: redefinition of ‘int modetwo()’

int modetwo() {

^

In file included from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:58:0:

sketch\tk-attiny.h:43:5: note: ‘int modetwo()’ previously defined here

int modetwo() {

^

In file included from sketch\tk-delay.h:24:0,

from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:164:

sketch\tk-attiny.h: In function ‘int modethree()’:

tk-attiny.h:48:5: error: redefinition of ‘int modethree()’

int modethree() {

^

In file included from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:58:0:

sketch\tk-attiny.h:48:5: note: ‘int modethree()’ previously defined here

int modethree() {

^

In file included from sketch\tk-delay.h:24:0,

from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:164:

sketch\tk-attiny.h: In function ‘void loop()’:

tk-attiny.h:56:6: error: redefinition of ‘void loop()’

void loop() {

^~

In file included from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:58:0:

sketch\tk-attiny.h:56:6: note: ‘void loop()’ previously defined here

void loop() {

^~

In file included from sketch\tk-delay.h:24:0,

from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:164:

sketch\tk-attiny.h: In function ‘void system_sleep()’:

tk-attiny.h:74:6: error: redefinition of ‘void system_sleep()’

void system_sleep() {

^~

In file included from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:58:0:

sketch\tk-attiny.h:74:6: note: ‘void system_sleep()’ previously defined here

void system_sleep() {

^~

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:30:0,

from sketch\sketch_jan21a.ino.cpp:1:

sketch\tk-attiny.h: In function ‘void __vector_2()’:

tk-attiny.h:81:5: error: redefinition of ‘void __vector_2()’

ISR (PCINT0_vect) {

^

sketch\tk-attiny.h:81:5: note: ‘void __vector_2()’ previously defined here

ISR (PCINT0_vect) {

^

In file included from sketch\tk-voltage.h:23:0,

from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:166:

sketch\tk-attiny.h: At global scope:

tk-attiny.h:11:5: error: redefinition of ‘int mode1’

int mode1 = 255;

^

In file included from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:58:0:

sketch\tk-attiny.h:11:5: note: ‘int mode1’ previously defined here

int mode1 = 255;

^

In file included from sketch\tk-voltage.h:23:0,

from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:166:

tk-attiny.h:12:5: error: redefinition of ‘int mode2’

int mode2 = 8;

^

In file included from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:58:0:

sketch\tk-attiny.h:12:5: note: ‘int mode2’ previously defined here

int mode2 = 8;

^

In file included from sketch\tk-voltage.h:23:0,

from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:166:

tk-attiny.h:15:11: error: redefinition of ‘const int ledPin’

const int ledPin = 0; // setting LED pin

^~

In file included from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:58:0:

sketch\tk-attiny.h:15:11: note: ‘const int ledPin’ previously defined here

const int ledPin = 0; // setting LED pin

^~

In file included from sketch\tk-voltage.h:23:0,

from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:166:

tk-attiny.h:17:54: error: redefinition of ‘unsigned int key’

unsigned int key attribute ((section (“.noinit”)));

^

In file included from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:58:0:

sketch\tk-attiny.h:17:14: note: ‘unsigned int key’ previously declared here

unsigned int key attribute ((section (“.noinit”)));

^

In file included from sketch\tk-voltage.h:23:0,

from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:166:

tk-attiny.h:19:55: error: redefinition of ‘unsigned int mode’

unsigned int mode attribute ((section (“.noinit”)));

^

In file included from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:58:0:

sketch\tk-attiny.h:19:14: note: ‘unsigned int mode’ previously declared here

unsigned int mode attribute ((section (“.noinit”)));

^~

In file included from sketch\tk-voltage.h:23:0,

from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:166:

sketch\tk-attiny.h: In function ‘void setup()’:

tk-attiny.h:21:6: error: redefinition of ‘void setup()’

void setup() {

^

In file included from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:58:0:

sketch\tk-attiny.h:21:6: note: ‘void setup()’ previously defined here

void setup() {

^

In file included from sketch\tk-voltage.h:23:0,

from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:166:

sketch\tk-attiny.h: In function ‘int modeone()’:

tk-attiny.h:38:5: error: redefinition of ‘int modeone()’

int modeone() {

^

In file included from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:58:0:

sketch\tk-attiny.h:38:5: note: ‘int modeone()’ previously defined here

int modeone() {

^

In file included from sketch\tk-voltage.h:23:0,

from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:166:

sketch\tk-attiny.h: In function ‘int modetwo()’:

tk-attiny.h:43:5: error: redefinition of ‘int modetwo()’

int modetwo() {

^

In file included from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:58:0:

sketch\tk-attiny.h:43:5: note: ‘int modetwo()’ previously defined here

int modetwo() {

^

In file included from sketch\tk-voltage.h:23:0,

from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:166:

sketch\tk-attiny.h: In function ‘int modethree()’:

tk-attiny.h:48:5: error: redefinition of ‘int modethree()’

int modethree() {

^

In file included from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:58:0:

sketch\tk-attiny.h:48:5: note: ‘int modethree()’ previously defined here

int modethree() {

^

In file included from sketch\tk-voltage.h:23:0,

from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:166:

sketch\tk-attiny.h: In function ‘void loop()’:

tk-attiny.h:56:6: error: redefinition of ‘void loop()’

void loop() {

^~

In file included from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:58:0:

sketch\tk-attiny.h:56:6: note: ‘void loop()’ previously defined here

void loop() {

^~

In file included from sketch\tk-voltage.h:23:0,

from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:166:

sketch\tk-attiny.h: In function ‘void system_sleep()’:

tk-attiny.h:74:6: error: redefinition of ‘void system_sleep()’

void system_sleep() {

^~

In file included from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:58:0:

sketch\tk-attiny.h:74:6: note: ‘void system_sleep()’ previously defined here

void system_sleep() {

^~

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:30:0,

from sketch\sketch_jan21a.ino.cpp:1:

sketch\tk-attiny.h: In function ‘void __vector_2()’:

tk-attiny.h:81:5: error: redefinition of ‘void __vector_2()’

ISR (PCINT0_vect) {

^

sketch\tk-attiny.h:81:5: note: ‘void __vector_2()’ previously defined here

ISR (PCINT0_vect) {

^

In file included from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:166:0:

sketch\tk-voltage.h: In function ‘void ADC_on_temperature()’:

sketch\tk-voltage.h:42:20: error: ‘V_REF’ was not declared in this scope

ADMUX = (1 << V_REF) | (1 << ADLAR) | TEMP_CHANNEL;

^

sketch\tk-voltage.h:42:44: error: ‘TEMP_CHANNEL’ was not declared in this scope

ADMUX = (1 << V_REF) | (1 << ADLAR) | TEMP_CHANNEL;

^~

sketch\tk-voltage.h:47:44: error: ‘ADC_PRSCL’ was not declared in this scope

ADCSRA = (1 << ADEN ) | (1 << ADSC ) | ADC_PRSCL;

^

sketch\tk-voltage.h:47:44: note: suggested alternative: ‘ADC_CRIT’

ADCSRA = (1 << ADEN ) | (1 << ADSC ) | ADC_PRSCL;

^

ADC_CRIT

sketch\tk-voltage.h: In function ‘void ADC_on()’:

sketch\tk-voltage.h:55:20: error: ‘ADC_DIDR’ was not declared in this scope

DIDR0 |= (1 << ADC_DIDR);

^~

sketch\tk-voltage.h:55:20: note: suggested alternative: ‘ADC_on’

DIDR0 |= (1 << ADC_DIDR);

^~

ADC_on

sketch\tk-voltage.h:57:20: error: ‘V_REF’ was not declared in this scope

ADMUX = (1 << V_REF) | (1 << ADLAR) | ADC_CHANNEL;

^

sketch\tk-voltage.h:57:44: error: ‘ADC_CHANNEL’ was not declared in this scope

ADMUX = (1 << V_REF) | (1 << ADLAR) | ADC_CHANNEL;

^

sketch\tk-voltage.h:59:44: error: ‘ADC_PRSCL’ was not declared in this scope

ADCSRA = (1 << ADEN ) | (1 << ADSC ) | ADC_PRSCL;

^

sketch\tk-voltage.h:59:44: note: suggested alternative: ‘ADC_CRIT’

ADCSRA = (1 << ADEN ) | (1 << ADSC ) | ADC_PRSCL;

^

ADC_CRIT

C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino: In function ‘void save_mode()’:

sketch_jan21a:234:27: error: ‘EEPSIZE’ was not declared in this scope

eepos = (eepos+1) & ((EEPSIZE/2)–1); // wear leveling, use next cell

^

C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:234:27: note: suggested alternative: ‘EEPE’

eepos = (eepos+1) & ((EEPSIZE/2)–1); // wear leveling, use next cell

^

EEPE

C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino: In function ‘void save_state()’:

sketch_jan21a:240:24: error: ‘EEPSIZE’ was not declared in this scope

#define OPT_firstboot (EEPSIZE-1)

^

C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:251:34: note: in expansion of macro ‘OPT_firstboot’

eeprom_write_byte((uint8_t *)OPT_firstboot, firstboot);

^

C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:240:24: note: suggested alternative: ‘EEPE’

#define OPT_firstboot (EEPSIZE-1)

^

C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:251:34: note: in expansion of macro ‘OPT_firstboot’

eeprom_write_byte((uint8_t *)OPT_firstboot, firstboot);

^

C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino: In function ‘void restore_state()’:

sketch_jan21a:240:24: error: ‘EEPSIZE’ was not declared in this scope

#define OPT_firstboot (EEPSIZE-1)

^

C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:270:39: note: in expansion of macro ‘OPT_firstboot’

eep = eeprom_read_byte((uint8_t *)OPT_firstboot);

^

C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:240:24: note: suggested alternative: ‘EEPE’

#define OPT_firstboot (EEPSIZE-1)

^

C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:270:39: note: in expansion of macro ‘OPT_firstboot’

eep = eeprom_read_byte((uint8_t *)OPT_firstboot);

^

C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino: In function ‘void set_output(uint8_t, uint8_t, uint8_t)’:

sketch_jan21a:406:5: error: ‘FET_PWM_LVL’ was not declared in this scope

FET_PWM_LVL = pwm1;

^

sketch_jan21a:407:5: error: ‘PWM_LVL’ was not declared in this scope

PWM_LVL = pwm2;

^

sketch_jan21a:408:5: error: ‘ALT_PWM_LVL’ was not declared in this scope

ALT_PWM_LVL = pwm3;

^

In file included from C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:166:0:

C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino: In function ‘uint8_t read_adc_8bit()’:

sketch\tk-voltage.h:31:25: error: redefinition of ‘uint8_t read_adc_8bit()’

#define get_temperature read_adc_8bit

^

C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:482:9: note: in expansion of macro ‘get_temperature’

uint8_t get_temperature() {

^

sketch\tk-voltage.h:70:9: note: ‘uint8_t read_adc_8bit()’ previously defined here

uint8_t read_adc_8bit() {

^

C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino: In function ‘uint8_t read_otc()’:

sketch_jan21a:501:20: error: ‘CAP_DIDR’ was not declared in this scope

DIDR0 |= (1 << CAP_DIDR);

^~

C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:501:20: note: suggested alternative: ‘CAP_MED’

DIDR0 |= (1 << CAP_DIDR);

^~

CAP_MED

sketch_jan21a:503:20: error: ‘V_REF’ was not declared in this scope

ADMUX = (1 << V_REF) | (1 << ADLAR) | CAP_CHANNEL;

^

sketch_jan21a:503:44: error: ‘CAP_CHANNEL’ was not declared in this scope

ADMUX = (1 << V_REF) | (1 << ADLAR) | CAP_CHANNEL;

^

sketch_jan21a:505:44: error: ‘ADC_PRSCL’ was not declared in this scope

ADCSRA = (1 << ADEN ) | (1 << ADSC ) | ADC_PRSCL;

^

C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:505:44: note: suggested alternative: ‘ADC_CRIT’

ADCSRA = (1 << ADEN ) | (1 << ADSC ) | ADC_PRSCL;

^

ADC_CRIT

C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino: In function ‘int main()’:

sketch_jan21a:524:20: error: ‘CAP_PIN’ was not declared in this scope

DDRB |= (1 << CAP_PIN); // Output

^

C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:524:20: note: suggested alternative: ‘CAP_MED’

DDRB |= (1 << CAP_PIN); // Output

^

CAP_MED

sketch_jan21a:528:19: error: ‘PWM_PIN’ was not declared in this scope

DDRB |= (1 << PWM_PIN); // enable main channel

^

C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:528:19: note: suggested alternative: ‘M_PI’

DDRB |= (1 << PWM_PIN); // enable main channel

^

M_PI

sketch_jan21a:529:19: error: ‘ALT_PWM_PIN’ was not declared in this scope

DDRB |= (1 << ALT_PWM_PIN); // enable second channel

^

C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:529:19: note: suggested alternative: ‘NOT_A_PIN’

DDRB |= (1 << ALT_PWM_PIN); // enable second channel

^

NOT_A_PIN

sketch_jan21a:532:19: error: ‘FET_PWM_PIN’ was not declared in this scope

DDRB |= (1 << FET_PWM_PIN); // enable third channel (DDB4)

^

C:\Users\pops\Documents\Arduino\sketch_jan21a\sketch_jan21a.ino:532:19: note: suggested alternative: ‘NOT_A_PIN’

DDRB |= (1 << FET_PWM_PIN); // enable third channel (DDB4)

^

NOT_A_PIN

exit status 1
redefinition of ‘int mode1’

This report would have more information with
“Show verbose output during compilation”
option enabled in File -> Preferences.

That does not appear to be generated from the file I posted

You are right, had too many files open and I selected the wrong one. I’ll test when I get more chips tomorrow. Thanks

with the right fuse setting you should not brick any chips

I had bricked chips when the leads from programmer to the clip were too long