electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » Arduino
Change from common anode to common cathode LED
Post new topic   Reply to topic
Page 1 of 1 [3 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
Mick Bailey



Joined: Jan 07, 2010
Posts: 15
Location: England

PostPosted: Tue Feb 22, 2022 3:24 am    Post subject: Change from common anode to common cathode LED Reply with quote  Mark this post and the followings unread

I've breadboarded the Hagiwo Arduino Nano quantizer and it works fine, but prefer the functions of the Luislutz version here:https://github.com/luislutz/Arduino_Quantizer

This appears to work except for the LED which was originally common cathode, but in the Luislutz version is common anode. What changes need to be made to the code to use common cathode? I've looked at various Arduino tutorials for this but can't see any similarity to the quantizer code, so any help would be appreciated.
Back to top
View user's profile Send private message
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24079
Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320

PostPosted: Tue Feb 22, 2022 8:07 am    Post subject: Reply with quote  Mark this post and the followings unread

At the bottom of the .ino it says :

Code:
void LED(byte R, byte G, byte B) {


 analogWrite(9,255-map(R,0,255,0,LED_Brightness));
 analogWrite(11,255-map(G,0,255,0,LED_Brightness));
 analogWrite(10,255-map(B,0,255,0,LED_Brightness));
}


And withe the inverted LED common-ness I'd assume this has to be be inverted too .. as in

Code:
void LED(byte R, byte G, byte B) {


 analogWrite(9,map(R,0,255,0,LED_Brightness));
 analogWrite(11,map(G,0,255,0,LED_Brightness));
 analogWrite(10,map(B,0,255,0,LED_Brightness));
}

_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
Mick Bailey



Joined: Jan 07, 2010
Posts: 15
Location: England

PostPosted: Wed Feb 23, 2022 2:10 am    Post subject: Reply with quote  Mark this post and the followings unread

Ah! I see how this works now you've pointed out where the code needs to be changed. I've just tried this and it works fine, though there's on issue in that the LED isn't sufficiently illuminated and each individual LED can be seen as a result. With the Hagiwo code this worked fine.

Does line 43 need changing to fix this - int LED_Brightness = 50; ?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic
Page 1 of 1 [3 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » Arduino
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use