Buradaki switch ile ( arasındaki boşluğu sil abi. Birde yukarıya eklediğin switch; 'i sil. o değişken olarak tanımlanmaz.
int state = 0;
int old=0;
int buttonPoll=0;
int pwm_acik=0;
int isik=analogRead(A0);
Derleme hatası Allahın emridir, Olmazsa korkmak lazım
43. satırdakini de silmeli tabii.16 satıraint buttonPoll;
ekleyip dener misin abi.
// Dosya adı: LDR.ino
#include <PWM.h>//eklendi
int led = 9; // eklendi
int32_t frequency = 50; //eklendi frequency (in Hz)
#define button 3
#define inPin0// giriş A0 pini
#define LED1 4
#define LED2 5
#define LED3 6
#define LED4 7
#define LED5 8
#define LED6 10
#define LED7 11
int buttonPoll;
void setup() {
pinMode(led,OUTPUT);
pinMode (button,INPUT);
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
pinMode (LED1,OUTPUT);
pinMode (LED2,OUTPUT);
pinMode (LED3,OUTPUT);
pinMode (LED4,OUTPUT);
pinMode (LED5,OUTPUT);
pinMode (LED6,OUTPUT);
pinMode (LED7,OUTPUT);
digitalWrite(LED1,LOW);
digitalWrite(LED2,LOW);
digitalWrite(LED3,LOW);
digitalWrite(LED4,LOW);
digitalWrite(LED5,LOW);
digitalWrite(LED6,LOW);
digitalWrite(LED6,LOW);
int state = 0;
int old=0;
int buttonPoll=0;
int pwm_acik=0;
int isik=analogRead(A0);
Serial.begin(9600);
Serial.println(isik);
}
void loop() {
buttonPoll =digitalRead(button);
if (buttonPoll ==1){
delay(50);
buttonPoll=digitalRead(button);
if (buttonPoll ==0){
state =old+1;
}
}
else{
delay(100);
}
isik=analogRead(A0);
if(isik>50){
pwm_acik=1;
}
else{
pwm_acik=0;
digitalWrite(led,LOW);
}
//switch(state){
case 1:
digitalWrite(LED1,HIGH);
digitalWrite(LED2,LOW);
digitalWrite(LED3,LOW);
digitalWrite(LED4,LOW);
digitalWrite(LED5,LOW);
digitalWrite(LED6,LOW);
digitalWrite(LED7,LOW);
if(pwm_acik)
{
pwmWrite(led, 26);
}
old=state;
break;
case 2:
digitalWrite(LED1,LOW);
digitalWrite(LED2,HIGH);
digitalWrite(LED3,LOW);
digitalWrite(LED4,LOW);
digitalWrite(LED5,LOW);
digitalWrite(LED6,LOW);
digitalWrite(LED7,LOW);
//pwmWrite(led, 44);
if(pwm_acik)
{
pwmWrite(led, 51);
}
old=state;
break;
case 3:
digitalWrite(LED1,LOW);
digitalWrite(LED2,LOW);
digitalWrite(LED3,HIGH);
digitalWrite(LED4,LOW);
digitalWrite(LED5,LOW);
digitalWrite(LED6,LOW);
digitalWrite(LED7,LOW);
//pwmWrite(led, 48);
if(pwm_acik)
{
pwmWrite(led, 76);
}
pwmWrite(led, 76);
old=state;
break;
case 4:
digitalWrite(LED1,LOW);
digitalWrite(LED2,LOW);
digitalWrite(LED3,LOW);
digitalWrite(LED4,HIGH);
digitalWrite(LED5,LOW);
digitalWrite(LED6,LOW);
digitalWrite(LED7,LOW);
//pwmWrite(led, 52);
pwmWrite(led, 102);
old=state;
break;
case 5:
digitalWrite(LED1,LOW);
digitalWrite(LED2,LOW);
digitalWrite(LED3,LOW);
digitalWrite(LED4,LOW);
digitalWrite(LED5,HIGH);
digitalWrite(LED6,LOW);
digitalWrite(LED7,LOW);
//pwmWrite(led, 58);
if(pwm_acik)
{
pwmWrite(led, 127);
}
old=state;
break;
case 6:
digitalWrite(LED1,LOW);
digitalWrite(LED2,LOW);
digitalWrite(LED3,LOW);
digitalWrite(LED4,LOW);
digitalWrite(LED5,LOW);
digitalWrite(LED6,HIGH);
digitalWrite(LED7,LOW);
//pwmWrite(led, 62);
if(pwm_acik)
{
pwmWrite(led, 153);
}
old=state;
break;
case 7:
digitalWrite(LED1,LOW);
digitalWrite(LED2,LOW);
digitalWrite(LED3,LOW);
digitalWrite(LED4,LOW);
digitalWrite(LED5,LOW);
digitalWrite(LED6,LOW);
digitalWrite(LED7,HIGH);
//pwmWrite(led, 78);
if(pwm_acik)
{
pwmWrite(led, 179);
}
old=state;
break;
default:
digitalWrite(LED1,LOW);
digitalWrite(LED2,LOW);
digitalWrite(LED3,LOW);
digitalWrite(LED4,LOW);
digitalWrite(LED5,LOW);
digitalWrite(LED6,LOW);
digitalWrite(LED7,LOW);
old=0;
break;
}
}
Ben derleme hatalarına bayılıyorum ya. Bulmaca çözmek gibi geliyor bana. yeterki içinden çıkamayacağım bir sorun olmasınDerleme hatası Allahın emridir, Olmazsa korkmak lazım
43. satırdakini de silmeli tabii.
5 mesaj yukarıda dediğimi yaptın mı abi?
int state = 0;
int old=0;
int buttonPoll=0;
int pwm_acik=0;
int isik=analogRead(A0);
// Dosya adı: LDR.ino
#include <PWM.h>//eklendi
int led = 9; // eklendi
int32_t frequency = 50; //eklendi frequency (in Hz)
#define button 3
#define inPin0// giriş A0 pini
#define LED1 4
#define LED2 5
#define LED3 6
#define LED4 7
#define LED5 8
#define LED6 10
#define LED7 11
//int buttonPoll;
void setup() {
pinMode(led,OUTPUT);
pinMode (button,INPUT);
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
pinMode (LED1,OUTPUT);
pinMode (LED2,OUTPUT);
pinMode (LED3,OUTPUT);
pinMode (LED4,OUTPUT);
pinMode (LED5,OUTPUT);
pinMode (LED6,OUTPUT);
pinMode (LED7,OUTPUT);
digitalWrite(LED1,LOW);
digitalWrite(LED2,LOW);
digitalWrite(LED3,LOW);
digitalWrite(LED4,LOW);
digitalWrite(LED5,LOW);
digitalWrite(LED6,LOW);
digitalWrite(LED6,LOW);
int state = 0;
int old=0;
int buttonPoll=0;
int pwm_acik=0;
int isik=analogRead(A0);
Serial.begin(9600);
Serial.println(isik);
}
void loop() {
buttonPoll =digitalRead(button);
if (buttonPoll ==1){
delay(50);
buttonPoll=digitalRead(button);
if (buttonPoll ==0){
state =old+1;
}
}
else{
delay(100);
}
isik=analogRead(A0);
if(isik>50){
pwm_acik=1;
}
else{
pwm_acik=0;
digitalWrite(led,LOW);
}
//switch(state){
case 1:
digitalWrite(LED1,HIGH);
digitalWrite(LED2,LOW);
digitalWrite(LED3,LOW);
digitalWrite(LED4,LOW);
digitalWrite(LED5,LOW);
digitalWrite(LED6,LOW);
digitalWrite(LED7,LOW);
if(pwm_acik)
{
pwmWrite(led, 26);
}
old=state;
break;
case 2:
digitalWrite(LED1,LOW);
digitalWrite(LED2,HIGH);
digitalWrite(LED3,LOW);
digitalWrite(LED4,LOW);
digitalWrite(LED5,LOW);
digitalWrite(LED6,LOW);
digitalWrite(LED7,LOW);
//pwmWrite(led, 44);
if(pwm_acik)
{
pwmWrite(led, 51);
}
old=state;
break;
case 3:
digitalWrite(LED1,LOW);
digitalWrite(LED2,LOW);
digitalWrite(LED3,HIGH);
digitalWrite(LED4,LOW);
digitalWrite(LED5,LOW);
digitalWrite(LED6,LOW);
digitalWrite(LED7,LOW);
//pwmWrite(led, 48);
if(pwm_acik)
{
pwmWrite(led, 76);
}
pwmWrite(led, 76);
old=state;
break;
case 4:
digitalWrite(LED1,LOW);
digitalWrite(LED2,LOW);
digitalWrite(LED3,LOW);
digitalWrite(LED4,HIGH);
digitalWrite(LED5,LOW);
digitalWrite(LED6,LOW);
digitalWrite(LED7,LOW);
//pwmWrite(led, 52);
pwmWrite(led, 102);
old=state;
break;
case 5:
digitalWrite(LED1,LOW);
digitalWrite(LED2,LOW);
digitalWrite(LED3,LOW);
digitalWrite(LED4,LOW);
digitalWrite(LED5,HIGH);
digitalWrite(LED6,LOW);
digitalWrite(LED7,LOW);
//pwmWrite(led, 58);
if(pwm_acik)
{
pwmWrite(led, 127);
}
old=state;
break;
case 6:
digitalWrite(LED1,LOW);
digitalWrite(LED2,LOW);
digitalWrite(LED3,LOW);
digitalWrite(LED4,LOW);
digitalWrite(LED5,LOW);
digitalWrite(LED6,HIGH);
digitalWrite(LED7,LOW);
//pwmWrite(led, 62);
if(pwm_acik)
{
pwmWrite(led, 153);
}
old=state;
break;
case 7:
digitalWrite(LED1,LOW);
digitalWrite(LED2,LOW);
digitalWrite(LED3,LOW);
digitalWrite(LED4,LOW);
digitalWrite(LED5,LOW);
digitalWrite(LED6,LOW);
digitalWrite(LED7,HIGH);
//pwmWrite(led, 78);
if(pwm_acik)
{
pwmWrite(led, 179);
}
old=state;
break;
default:
digitalWrite(LED1,LOW);
digitalWrite(LED2,LOW);
digitalWrite(LED3,LOW);
digitalWrite(LED4,LOW);
digitalWrite(LED5,LOW);
digitalWrite(LED6,LOW);
digitalWrite(LED7,LOW);
old=0;
break;
}
}
Abi ben derleyecektim de kütüphanede pwm kütüphanesini bulamadım. sendeki kütüphaneyi ekler misin buraya?Yani şimdi ekledim o satıları bu seferde başka bir hata veriyor
Son halini tekrar ekleyeyim .Nerede hata veriyorsa sen yada semih bey baksa ;hatasiz derleyene kadar
Bu arada kodda Photodiyotun A0 tanımlaması da eksik sanırım
Kod:int state = 0; int old=0; int buttonPoll=0; int pwm_acik=0; int isik=analogRead(A0); // Dosya adı: LDR.ino #include <PWM.h>//eklendi int led = 9; // eklendi int32_t frequency = 50; //eklendi frequency (in Hz) #define button 3 #define inPin0// giriş A0 pini #define LED1 4 #define LED2 5 #define LED3 6 #define LED4 7 #define LED5 8 #define LED6 10 #define LED7 11 //int buttonPoll; void setup() { pinMode(led,OUTPUT); pinMode (button,INPUT); pinMode(13, OUTPUT); digitalWrite(13, HIGH); pinMode (LED1,OUTPUT); pinMode (LED2,OUTPUT); pinMode (LED3,OUTPUT); pinMode (LED4,OUTPUT); pinMode (LED5,OUTPUT); pinMode (LED6,OUTPUT); pinMode (LED7,OUTPUT); digitalWrite(LED1,LOW); digitalWrite(LED2,LOW); digitalWrite(LED3,LOW); digitalWrite(LED4,LOW); digitalWrite(LED5,LOW); digitalWrite(LED6,LOW); digitalWrite(LED6,LOW); int state = 0; int old=0; int buttonPoll=0; int pwm_acik=0; int isik=analogRead(A0); Serial.begin(9600); Serial.println(isik); } void loop() { buttonPoll =digitalRead(button); if (buttonPoll ==1){ delay(50); buttonPoll=digitalRead(button); if (buttonPoll ==0){ state =old+1; } } else{ delay(100); } isik=analogRead(A0); if(isik>50){ pwm_acik=1; } else{ pwm_acik=0; digitalWrite(led,LOW); } //switch(state){ case 1: digitalWrite(LED1,HIGH); digitalWrite(LED2,LOW); digitalWrite(LED3,LOW); digitalWrite(LED4,LOW); digitalWrite(LED5,LOW); digitalWrite(LED6,LOW); digitalWrite(LED7,LOW); if(pwm_acik) { pwmWrite(led, 26); } old=state; break; case 2: digitalWrite(LED1,LOW); digitalWrite(LED2,HIGH); digitalWrite(LED3,LOW); digitalWrite(LED4,LOW); digitalWrite(LED5,LOW); digitalWrite(LED6,LOW); digitalWrite(LED7,LOW); //pwmWrite(led, 44); if(pwm_acik) { pwmWrite(led, 51); } old=state; break; case 3: digitalWrite(LED1,LOW); digitalWrite(LED2,LOW); digitalWrite(LED3,HIGH); digitalWrite(LED4,LOW); digitalWrite(LED5,LOW); digitalWrite(LED6,LOW); digitalWrite(LED7,LOW); //pwmWrite(led, 48); if(pwm_acik) { pwmWrite(led, 76); } pwmWrite(led, 76); old=state; break; case 4: digitalWrite(LED1,LOW); digitalWrite(LED2,LOW); digitalWrite(LED3,LOW); digitalWrite(LED4,HIGH); digitalWrite(LED5,LOW); digitalWrite(LED6,LOW); digitalWrite(LED7,LOW); //pwmWrite(led, 52); pwmWrite(led, 102); old=state; break; case 5: digitalWrite(LED1,LOW); digitalWrite(LED2,LOW); digitalWrite(LED3,LOW); digitalWrite(LED4,LOW); digitalWrite(LED5,HIGH); digitalWrite(LED6,LOW); digitalWrite(LED7,LOW); //pwmWrite(led, 58); if(pwm_acik) { pwmWrite(led, 127); } old=state; break; case 6: digitalWrite(LED1,LOW); digitalWrite(LED2,LOW); digitalWrite(LED3,LOW); digitalWrite(LED4,LOW); digitalWrite(LED5,LOW); digitalWrite(LED6,HIGH); digitalWrite(LED7,LOW); //pwmWrite(led, 62); if(pwm_acik) { pwmWrite(led, 153); } old=state; break; case 7: digitalWrite(LED1,LOW); digitalWrite(LED2,LOW); digitalWrite(LED3,LOW); digitalWrite(LED4,LOW); digitalWrite(LED5,LOW); digitalWrite(LED6,LOW); digitalWrite(LED7,HIGH); //pwmWrite(led, 78); if(pwm_acik) { pwmWrite(led, 179); } old=state; break; default: digitalWrite(LED1,LOW); digitalWrite(LED2,LOW); digitalWrite(LED3,LOW); digitalWrite(LED4,LOW); digitalWrite(LED5,LOW); digitalWrite(LED6,LOW); digitalWrite(LED7,LOW); old=0; break; } }
klasördür abi kendisi. ya belgeler--> arduino --> library altındadır. Yada Program Files(x86) -->Arduino->Library altındadır.PWM Kütüphanesinin uzantısı nedir?
Abi bunu sen tek başına mı zipledin? klasör içinde başka dosya yok muydu? Komple klasörün kendisi lazım.
Al abi bu şekilde hata vermeden derlendi. Photodiyotu da ekledim.
// Dosya adı: LDR.ino
#include <PWM.h>//eklendi
int led = 9; // eklendi
int32_t frequency = 50; //eklendi frequency (in Hz)
#define button 3
#define photoDiode A0 // giriş A0 pini
#define LED1 4
#define LED2 5
#define LED3 6
#define LED4 7
#define LED5 8
#define LED6 10
#define LED7 11
int state = 0;
int old=0;
int buttonPoll=0;
int pwm_acik=0;
int isik=analogRead(photoDiode);
void setup() {
pinMode(led,OUTPUT);
pinMode (button,INPUT);
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
pinMode (LED1,OUTPUT);
pinMode (LED2,OUTPUT);
pinMode (LED3,OUTPUT);
pinMode (LED4,OUTPUT);
pinMode (LED5,OUTPUT);
pinMode (LED6,OUTPUT);
pinMode (LED7,OUTPUT);
digitalWrite(LED1,LOW);
digitalWrite(LED2,LOW);
digitalWrite(LED3,LOW);
digitalWrite(LED4,LOW);
digitalWrite(LED5,LOW);
digitalWrite(LED6,LOW);
digitalWrite(LED6,LOW);
Serial.begin(9600);
Serial.println(isik);
}
void loop() {
buttonPoll =digitalRead(button);
if (buttonPoll ==1){
delay(50);
buttonPoll=digitalRead(button);
if (buttonPoll ==0){
state =old+1;
}
}
else{
delay(100);
}
isik=analogRead(photoDiode);
if(isik>50){
pwm_acik=1;
}
else{
pwm_acik=0;
digitalWrite(led,LOW);
}
switch (state){
case 1:
digitalWrite(LED1,HIGH);
digitalWrite(LED2,LOW);
digitalWrite(LED3,LOW);
digitalWrite(LED4,LOW);
digitalWrite(LED5,LOW);
digitalWrite(LED6,LOW);
digitalWrite(LED7,LOW);
if(pwm_acik)
{
pwmWrite(led, 26);
}
old=state;
break;
case 2:
digitalWrite(LED1,LOW);
digitalWrite(LED2,HIGH);
digitalWrite(LED3,LOW);
digitalWrite(LED4,LOW);
digitalWrite(LED5,LOW);
digitalWrite(LED6,LOW);
digitalWrite(LED7,LOW);
//pwmWrite(led, 44);
if(pwm_acik)
{
pwmWrite(led, 51);
}
old=state;
break;
case 3:
digitalWrite(LED1,LOW);
digitalWrite(LED2,LOW);
digitalWrite(LED3,HIGH);
digitalWrite(LED4,LOW);
digitalWrite(LED5,LOW);
digitalWrite(LED6,LOW);
digitalWrite(LED7,LOW);
//pwmWrite(led, 48);
if(pwm_acik)
{
pwmWrite(led, 76);
}
pwmWrite(led, 76);
old=state;
break;
case 4:
digitalWrite(LED1,LOW);
digitalWrite(LED2,LOW);
digitalWrite(LED3,LOW);
digitalWrite(LED4,HIGH);
digitalWrite(LED5,LOW);
digitalWrite(LED6,LOW);
digitalWrite(LED7,LOW);
//pwmWrite(led, 52);
pwmWrite(led, 102);
old=state;
break;
case 5:
digitalWrite(LED1,LOW);
digitalWrite(LED2,LOW);
digitalWrite(LED3,LOW);
digitalWrite(LED4,LOW);
digitalWrite(LED5,HIGH);
digitalWrite(LED6,LOW);
digitalWrite(LED7,LOW);
//pwmWrite(led, 58);
if(pwm_acik)
{
pwmWrite(led, 127);
}
old=state;
break;
case 6:
digitalWrite(LED1,LOW);
digitalWrite(LED2,LOW);
digitalWrite(LED3,LOW);
digitalWrite(LED4,LOW);
digitalWrite(LED5,LOW);
digitalWrite(LED6,HIGH);
digitalWrite(LED7,LOW);
//pwmWrite(led, 62);
if(pwm_acik)
{
pwmWrite(led, 153);
}
old=state;
break;
case 7:
digitalWrite(LED1,LOW);
digitalWrite(LED2,LOW);
digitalWrite(LED3,LOW);
digitalWrite(LED4,LOW);
digitalWrite(LED5,LOW);
digitalWrite(LED6,LOW);
digitalWrite(LED7,HIGH);
//pwmWrite(led, 78);
if(pwm_acik)
{
pwmWrite(led, 179);
}
old=state;
break;
default:
digitalWrite(LED1,LOW);
digitalWrite(LED2,LOW);
digitalWrite(LED3,LOW);
digitalWrite(LED4,LOW);
digitalWrite(LED5,LOW);
digitalWrite(LED6,LOW);
digitalWrite(LED7,LOW);
old=0;
break;
}
}
Amanın bende de derlediAl abi bu şekilde hata vermeden derlendi. Photodiyotu da ekledim.