OK...I'm at the end of my tether in trying to program my ATMEGA328P-AU. I went through every thread and google links and tried to program the darn thing. I first tried using the ATMEL studio 6.2 from recovering the hex file. I tried using the UNO as a programmer. I used the gammon.com.au website forum and used his method.
The furthest I got was programming the bootloader to the MCU using Gammons method, but could not get the sketch onto it. I keep getting the (i forgot now because I needed a few weeks to cool off) - "expect error". I done some search on that error and it referenced to not seeing the device. I checked and rechecked and rechecked the pcb and everything is where it is supposed to be connected. Pull up resistors, decoupling caps all in place.
I'm now wondering about fuses and possibly the code. The code is a simple use of the 6 PWM outputs to fade the LEDs randomly. It works on the UNO, but I don't know enough about the code if it uses the internal clock of the ATMEGA on the UNO or the crystal ( I ripped the code and modified it to work on 6 LEDs). The bootloader programmed OK without the use of a crystal or resonator.
Any ideas of where to go next without ripping out what's left of my hair.
Here's the code:
int thr=0; // represents brightness for pin,
int fiv=50; // each integer's name is the firs three letters of the pin
int six=100; // it represents of the pin it represents this is just to keep
int nin=150; // track it represents
int ten=205;
int ele=255;
int c1=5; //c represents change, each pin gets its own change
int c2=5; // so it wont interfere with any other pin
int c3=5;
int c4=5;
int c5=5;
int c6=5;
void setup(){
pinMode(3,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
pinMode(11,OUTPUT);
}
void loop(){
analogWrite(3,thr);
thr=thr+c1;
analogWrite(5,fiv);
fiv=fiv-c2;
analogWrite(6,six);
six=six-c3;
analogWrite(9,nin);
nin=nin-c4;
analogWrite(10,ten);
ten=ten-c5;
analogWrite(11,ele);
ele=ele-c6;
if(thr==0 || thr==255){
c1=-c1;
}
if(fiv==20 || fiv==255){
c2=-c2;
}
if(six==20 || six==255){
c3=-c3;
}
if(nin==30 || nin==255){
c4=-c4;
}
if(ten==20 || ten==255){
c5=-c5;
}
if(ele==10 || ele==255){
c6=-c6;
}
delay(30);
}









