This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
projects:c-info-wand [2015/04/19 05:14] smile [elektronic] |
projects:c-info-wand [2015/04/19 05:45] uk |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== c-info-wand ====== | ====== c-info-wand ====== | ||
+ | |||
+ | {{:projects:c-info-wall.jpg?200|}} | ||
===== elektronic ===== | ===== elektronic ===== | ||
Line 5: | Line 7: | ||
* connected launchpad | * connected launchpad | ||
* 3 RGB LED stripes (common +) | * 3 RGB LED stripes (common +) | ||
- | * PWM PINs: | + | * MOSFETs: IRL540N |
+ | * Schaltung ist wie beim Ingress-Table: https://github.com/c-base/ingress-table#led-driver-circuit | ||
+ | * PWM-PINs in RGB-Dreier-Gruppen: | ||
+ | * erste Gruppe: PM_3, PD_1, PD_0 | ||
+ | * zweite Gruppe: PL_4, PL_5, PM_1 | ||
+ | * dritte Gruppe: PM_7, PA_7, PM_6 | ||
+ | * Pinout siehe: http://energia.nu/img/EK-TM4C1294XL.jpg | ||
+ | ===== code ===== | ||
+ | |||
+ | * Sourcecode uses energia: http://energia.nu/ | ||
+ | * Sourcecode on github: https://gist.github.com/uwekamper/ebefbdc992248407a1e7 | ||
+ | |||
+ | <code> | ||
+ | /* | ||
+ | Fade for c-info wall at c-base. | ||
+ | Works with TI's connected launchpad and the energia.nu IDE. | ||
+ | */ | ||
+ | |||
+ | // Apparently the preprocessor variables B0 and B1 are already taken. | ||
+ | // Therefore we use the prefix CBASE | ||
+ | |||
+ | #define CBASER0 PM_3 | ||
+ | #define CBASEG0 PD_1 | ||
+ | #define CBASEB0 PD_0 | ||
+ | |||
+ | #define CBASER1 PL_4 | ||
+ | #define CBASEG1 PL_5 | ||
+ | #define CBASEB1 PM_1 | ||
+ | |||
+ | #define CBASER2 PM_7 | ||
+ | #define CBASEG2 PA_7 | ||
+ | #define CBASEB2 PM_6 | ||
+ | int brightness = 50; // how bright the LED is | ||
+ | int fadeAmount = 1; // how many points to fade the LED by | ||
+ | void setup() { | ||
+ | pinMode(CBASER0, OUTPUT); | ||
+ | pinMode(CBASEG0, OUTPUT); | ||
+ | pinMode(CBASEB0, OUTPUT); | ||
+ | pinMode(CBASER1, OUTPUT); | ||
+ | pinMode(CBASEG1, OUTPUT); | ||
+ | pinMode(CBASEB1, OUTPUT); | ||
+ | pinMode(CBASER2, OUTPUT); | ||
+ | pinMode(CBASEG2, OUTPUT); | ||
+ | pinMode(CBASEB2, OUTPUT); | ||
+ | } | ||
+ | void loop() { | ||
+ | if (brightness < 90) { | ||
+ | fadeAmount = 1; | ||
+ | } | ||
+ | | ||
+ | if (brightness >= 255) { | ||
+ | fadeAmount = -1; | ||
+ | } | ||
+ | | ||
+ | // There was some problem with the upper-most LED stripe. | ||
+ | // That is why we just set this one to full brightness forever. | ||
+ | analogWrite(CBASER0, 255); | ||
+ | analogWrite(CBASEG0, 255); | ||
+ | analogWrite(CBASEB0, 255); | ||
+ | | ||
+ | // The rest of the wall is pulsing. | ||
+ | analogWrite(CBASER1, brightness); | ||
+ | analogWrite(CBASEG1, brightness); | ||
+ | analogWrite(CBASEB1, brightness); | ||
+ | analogWrite(CBASER2, brightness); | ||
+ | analogWrite(CBASEG2, brightness); | ||
+ | analogWrite(CBASEB2, brightness); | ||
+ | delay(10); | ||
+ | | ||
+ | brightness = brightness + fadeAmount; | ||
+ | } | ||
+ | </code> |