looking for lightning code for attiny85

14 posts / 0 new
Last post
pinkpanda3310
pinkpanda3310's picture
Offline
Last seen: 3 hours 6 sec ago
Joined: 12/28/2013 - 08:45
Posts: 2990
Location: Perth
looking for lightning code for attiny85

As the title states. I’ve looked around but it all seems to be applicable to rgb led strips. I want single led lighting ../ ..lightning Cool

I prefer something that can be used in ArduinoIDE.

Thanks for any help

  

YuvalS
YuvalS's picture
Offline
Last seen: 6 hours 1 min ago
Joined: 09/26/2018 - 10:39
Posts: 467

What exactly do you want the code to do?

My FW repository

My BLF/OL contest entries: 7th 8th 9th 

pinkpanda3310
pinkpanda3310's picture
Offline
Last seen: 3 hours 6 sec ago
Joined: 12/28/2013 - 08:45
Posts: 2990
Location: Perth

lightning effect like in the andruil UI

  

Quadrupel
Quadrupel's picture
Offline
Last seen: 8 hours 59 min ago
Joined: 12/03/2017 - 10:40
Posts: 729
Location: Lithuania

So maybe possible to extract it from Anduril code?

pinkpanda3310
pinkpanda3310's picture
Offline
Last seen: 3 hours 6 sec ago
Joined: 12/28/2013 - 08:45
Posts: 2990
Location: Perth

I’m a numpty when it comes to digital stuff. Can you explain how to do that please Silly

  

YuvalS
YuvalS's picture
Offline
Last seen: 6 hours 1 min ago
Joined: 09/26/2018 - 10:39
Posts: 467

pinkpanda3310 wrote:
I'm a numpty when it comes to digital stuff. Can you explain how to do that please :P

Here you go:
https://github.com/YuvalSob/CavingHeadlampsFW/tree/main/Lightning

T
ested it on Attiny13, hope 85 will also work

My FW repository

My BLF/OL contest entries: 7th 8th 9th 

pinkpanda3310
pinkpanda3310's picture
Offline
Last seen: 3 hours 6 sec ago
Joined: 12/28/2013 - 08:45
Posts: 2990
Location: Perth

Awesome! Thanks YuvalS, I’ll try it when i get home from work Beer

  

pinkpanda3310
pinkpanda3310's picture
Offline
Last seen: 3 hours 6 sec ago
Joined: 12/28/2013 - 08:45
Posts: 2990
Location: Perth

I tried to flash the attiny85 but no success. It seems to upload to the chip fine but doesn’t light the led. Does it matter that i’m only using pin5 (PB0) for output?

  

YuvalS
YuvalS's picture
Offline
Last seen: 6 hours 1 min ago
Joined: 09/26/2018 - 10:39
Posts: 467

Sorry i am not by the computer now.

Try replacing ALL OCR0B to OCR0A 

My FW repository

My BLF/OL contest entries: 7th 8th 9th 

pinkpanda3310
pinkpanda3310's picture
Offline
Last seen: 3 hours 6 sec ago
Joined: 12/28/2013 - 08:45
Posts: 2990
Location: Perth

I literally just tried that while i was waiting. Didn’t work, of course Sad

  

YuvalS
YuvalS's picture
Offline
Last seen: 6 hours 1 min ago
Joined: 09/26/2018 - 10:39
Posts: 467

If you replaced all 4 occurrence I have no other idea and need my computer for debug 

My FW repository

My BLF/OL contest entries: 7th 8th 9th 

pinkpanda3310
pinkpanda3310's picture
Offline
Last seen: 3 hours 6 sec ago
Joined: 12/28/2013 - 08:45
Posts: 2990
Location: Perth

"All 4 occurrence".....??? There was only 2 lines with TCCR0A

DDRB = 0; // Reset all pins to input
DDRB |= (1 << DDB1); // Set pin 6 (PB1) to output (1)
DDRB |= (1 << DDB0); // Set pin 5 (PB0) to output (1)

// PWN configuration
TCCR0A = 0b10100001;
TCCR0B = 0b00000001;

  

YuvalS
YuvalS's picture
Offline
Last seen: 6 hours 1 min ago
Joined: 09/26/2018 - 10:39
Posts: 467

No sir, please have a look on lines 44, 54, 63, 72 and change OCR0B -> OCR0A
(Undo all your previous changes)

My FW repository

My BLF/OL contest entries: 7th 8th 9th 

pinkpanda3310
pinkpanda3310's picture
Offline
Last seen: 3 hours 6 sec ago
Joined: 12/28/2013 - 08:45
Posts: 2990
Location: Perth

YES!!! That worked. Thank you very much YuvalS Beer Beer