Hello, I'm writing this simple PWM led controller program and it looks like whenever I start using analogWrite(), the delay() function stops working. I'm using a breaboard version of the arduino with the internal osc. set at 8Mhz (with no divider) with a makefile (both CPU_FREQ and F_CPU are set at 8000000 using -D). Fuses are set as such: L:0xE2, H:0xDD, E:0xFF (0x07 for avrdude not to mess up).
I really don't get it Ô.o
Any ideas?
Here's the code
main.h
#ifndef _MAIN_H_
#define _MAIN_H_
/**
* Pin definitions
**/
#define pinRearLight 9
#define pinFrontLight 10
#define pinSettingBtn 8
/**
* Dim level definitions
**/
#define dimLevel0 255
#define dimLevel1 190
#define dimLevel2 125
#define dimLevel3 63
#define dimLevel4 0
#define dimLevelDefault dimLevel1
// High/low ratio
#define dimLevelLow 0.66
// Setting button debounce interval
#define bounceInterval 50
/**
* Variable declarations
**/
uint16_t previousMillis, previousMillisSettingBtn;
uint8_t rearLightInterval, rearLightValue, readLightIncrement;
boolean settingBtnVal = false;
boolean settingBtnLastVal = false;
int8_t bounceTime = 0;
int8_t settingBtnPhase = -1;
boolean breakStatus = false;
uint8_t rearBlinkPhase = 0;
boolean frontHighState = false;
uint8_t frontDimLevel = 0;
/**
* Prototypes
**/
void rearLightOff(void);
void rearLightOn(void);
void writeDimLevel(void);
void readDimLevel(void);
void changeFrontHighStatus(void);
void setFrontLight(void);
void changeBreakStatus(void);
#endif /* End of Main.h */
main.pde to follow