I am trying to upload my arduino code inside of ATMGE16A PU microcontroller. I searched so many source about that but I just can load blinky code. It was worked but if,else, while .... loops doesnt worked . Anyone know the truth circuit diagram and how can I load my code ?
This was the method i tried and it didn't work: 1-) Programmed my arduino uno with Arduino ISP code Programmer: AVRISP MKLL
2-) Connected my circuit diagram as the screenshot below.
3-)Tried to burn bootloader (doesnt work ), and tried to direct load (doesnt worked too)
4-) Removed 22mF capacitors and i could load my code but now IF ELSE loopes doesnt works well or doesnt works sometimes.
//ANALOG DEĞER OKUNAN PİNLER//
int pedalValue;
int wheelAngleValue;
//int speedValue;
//direksiyon parametreleri//
//float right; //direksiyon sağ
//float left; //direksiyon sol
//float noDirection; //direksiyon orta
void setup() {
pinMode(9, OUTPUT); // sol motor
pinMode(10, OUTPUT);// sağ motor
Serial.begin(9600);
}
void loop() {
// pedalValue = analogRead(5);//pin1
pedalValue = analogRead(A1);
pedalValue = map(pedalValue, 0, 1023, 0 , 255); //1023 fitting 255
wheelAngleValue = analogRead(A0);//pin2
wheelAngleValue = map(wheelAngleValue, 0, 1023, 0 , 255); //1023 fitting 255
Serial.println(wheelAngleValue);
Serial.println(pedalPin);
// speedValue = analogRead(5);//pin3
//wheel rotate right sheesh
if (wheelAngleValue > 137)
{
analogWrite(9, pedalValue); // sol motor hız kontrol
analogWrite(10, pedalValue * 0); // sağ motor hız kontrol
}
//wheel rotate left sheesh
else if (wheelAngleValue < 117)
{
analogWrite(9, pedalValue * 0); // sol motor hız kontrol
analogWrite(10, pedalValue); // sağ motor hız kontrol
analogWrite(9, pedalValue); // sol motor hız kontrol
analogWrite(10, pedalValue); // sağ motor hız kontrol
}
}
This is my code it works clearly on arduino but not works with ATMEL16A DIP integreted. I tested with blinky blinky works well but when I add simple If Else loop in code ATMEL16A doesnt works with loops.
didn't have any problems and when I tested the code with the potentiometer, I got the results I wanted. what kind of problem do you think is the "<" sign to be used? (tested with arduino uno not atmega16a)
#include "PWM.h"
#define pedalPin //analog pin1
#define wheelAngle//analog pin2
#define speedMeter //analog pin3
//PWM FREKANS VE PİNLERİ//
//int pwm_pin1 = 9;
//int pwm_pin2 = 10;
//int32_t frekans = 16600;
//ANALOG DEĞER OKUNAN PİNLER//
int pedalValue;
int wheelAngleValue;
//int speedValue;
//direksiyon parametreleri//
//float right; //direksiyon sağ
//float left; //direksiyon sol
//float noDirection; //direksiyon orta
void setup() {
pinMode(9, OUTPUT); // sol motor
pinMode(10, OUTPUT);// sağ motor
Serial.begin(9600);
}
void loop() {
// pedalValue = analogRead(5);//pin1
pedalValue = analogRead(A1)>>2;
//pedalValue = map(pedalValue, 0, 1023, 0 , 255); //1023 fitting 255
wheelAngleValue = analogRead(A0)>>2;//pin2
//wheelAngleValue = map(wheelAngleValue, 0, 1023, 0 , 255); //1023 fitting 255
Serial.println(wheelAngleValue);
Serial.println(pedalPin);
// speedValue = analogRead(5);//pin3
//wheel rotate right sheesh
if (wheelAngleValue > 137)
{
analogWrite(9, pedalValue); // sol motor hız kontrol
digitalWrite(10, 0); // sağ motor hız kontrol
}
//wheel rotate left sheesh
else if (wheelAngleValue < 117)
{
digitalWrite(9, 0); // sol motor hız kontrol
analogWrite(10, pedalValue); // sağ motor hız kontrol
}
//wheel rotate middle sheesh
else
{
analogWrite(9, pedalValue); // sol motor hız kontrol
analogWrite(10, pedalValue); // sağ motor hız kontrol
}
}
8.4 (page 26 "atmel-8154-8-bit-avr-atmega16a_datasheet.pdf")
For resonators, the maximum frequency is 8 MHz with CKOPT unprogrammed and 16 MHz with CKOPT programmed.