Projekte
ccaero
LED_Fading
main.c
Projekte
Forum
Doku
Öffentliche Projekte
Startseite
Beispielprogramme
Projekte von anderen
Welcome
Username
Passwort
Eingeloggt bleiben
Zugangsdaten vergessen?
Registrieren
Projektverwaltung
⇨ Please choose! ⇦
——————————————————
✎ Create new project...
★ Browse existing projects...
——————————————————
⚬ MotorTest#1
⚬ C Tutorial 8#1
⚬ NIBO2 C Project#1
⚙ C Tutorial 15#1
⚬ 2010_11_18_el_test001#1
LED_Fading
main.c
Project details
Compiler settings
Nachrichten
Sie sind nicht eingeloggt.
Neuigkeiten
★
NiboRoboLib 3.6
2017-01-17: Neue Version 3.6
★
NiboRoboLib 3.4.1
2016-04-16: Neue Version 3.4.1
★
Coding Tutorial
2015-11-22: Jetzt auch für den NIBO burger!
Site-Statistic
7426 private projects
385 public projects
16180353 lines compiled
58212 builds
NIBO
@
led_fading/main.c [read only]
#include <nibobee/iodefs.h> #include <nibobee/led.h> volatile uint16_t pwm_max=1024; volatile uint16_t pwm_duty=0; volatile uint16_t pwm_duty2=0; const uint16_t pwmtable_16[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 22, 22, 23, 23, 24, 25, 25, 26, 27, 28, 28, 29, 30, 31, 32, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 49, 50, 51, 53, 54, 56, 57, 59, 61, 62, 64, 66, 68, 69, 71, 73, 75, 77, 79, 82, 84, 86, 89, 91, 94, 96, 99, 102, 104, 107, 110, 113, 116, 120, 123, 126, 130, 133, 137, 141, 145, 149, 153, 157, 161, 166, 170, 175, 180, 185, 190, 195, 200, 206, 211, 217, 223, 229, 236, 242, 249, 256, 263, 270, 278, 285, 293, 301, 309, 318, 327, 336, 345, 354, 364, 374, 385, 395, 406, 417, 429, 441, 453, 465, 478, 491, 505, 519, 533, 548, 563, 578, 594, 610, 627, 644, 662, 680, 699, 719, 738, 759, 780, 801, 823, 846, 869, 893, 918, 943, 969, 996, 1023 }; ISR(TIMER0_COMP_vect) { static uint16_t pwm_tick=0; static uint8_t pwm=0; static uint8_t pwm2=0; static uint16_t count1=0; static uint8_t count2=0; static uint8_t toggle=0; static uint8_t toggle_sel=0; static uint8_t toggle_sel2=255; pwm_tick++; if (pwm_tick >= pwm_max) pwm_tick=0; if (pwm_tick < pwm_duty) pwm=1; else pwm=0; if (pwm_tick < pwm_duty2) pwm2=1; else pwm2=0; led_set(LED_L_YE,pwm); //led_set(LED_L_RD,!pwm); led_set(LED_R_YE,pwm2); //led_set(LED_R_RD,pwm); if (count2 == 1) { count1++; count2=0; } else { count2++; } if (count1 == 100) { if (toggle) { toggle_sel=toggle_sel-1; toggle_sel2++; } else { toggle_sel++; toggle_sel2=toggle_sel2-1; } if (toggle_sel == 255) toggle=1; else if (toggle_sel == 0) toggle=0; pwm_duty=pwmtable_16[toggle_sel]; pwm_duty2=pwmtable_16[toggle_sel2]; count1=0; } } int main () { //Timer0 konfiguerien TCCR0 |= (1<<WGM01) | (1<<CS01) | (0<<CS00); OCR0 |= 30; //Compare-Wert TIMSK |= (1<<OCIE0); led_init(); enable_interrupts(); while(1) { } }
Compiler results:
Werbung
Online
alfonzo03o76876
alicevib4869957876
angelinahirsch2667
angiesonnier022051
austineverard39
belindaskalski6
blairembley00135154
catherinemccaffrey57
chandradillion322729
clara581611207854
claysadleir964730
clemmielcg304935418
courtneymccafferty56
deandnv25751532757234
drusillapayne578806
elenal09427874464490
freddymunson4969971
fugbetsy84526872
guillermoherrick8
hassanlaboureyas8
humbertoann148070
jaclyntrevino203141
jamierapp475936
janellegard4477
josephinechitwood01
kathy34q1174942
kristeenchaves915
lenoretousignant247
lidamascorro550
loviematthies002
maxiepalfreyman85
melisacastiglia060
nganbolton343216575
rolandokilgour324331
shaneldisher04604335
simah379808986344
tiffaniscott025
torriarscott25066
warrenhinder6456
williepinkston9240