merhaba , bir süredir üzerinde çalıştığım projenin kodlarında sıkıntı çekiyorum.
#include <Servo.h>
#include <AFMotor.h>
AF_DCMotor motoru1 (1);
AF_DCMotor motoru2 (2);
AF_DCMotor motoru3 (3);
AF_DCMotor motoru4 (4);
Servo servo;
int durum;
int Hiz=255;
void setup() {
motor1.setSpeed (Hız);
motor2.setSpeed (Hız);
motor3.setSpeed (Hız);
motor4.setSpeed (Hız);
servo.attach(7);
int aciDegeri=45;
Serial.begin(9600);
}
void loop() {
if(Serial.available() > 0){
durum = Serial.read();
servo.write(45);
}
// Uygulamadan ayarlanabilen 3 hız seviyesi.(Değerler 0-255 arası)
if (durum == '1'){
Hiz=50;}
else if (durum == '2'){
Hiz=150;}
else if (durum == '3'){
Hiz=255;}
geçersiz döngü () {
eğer (Serial.available ()> 0) {
değer = Serial.read ();
/******************** İleri *************************/
if (durum == 'F') {
motor1.run (FORWARD);
motor2.run (FORWARD);
motor3.run (FORWARD);
motor4.run (FORWARD);
}
/****************** İleri Sağ *********************/
else if (durum == 'I') {
motor1.run (FORWARD);
motor2.run (FORWARD);
motor3.run (FORWARD);
motor4.run (FORWARD);
servo.write(90);
}
/****************** İleri Sol ********************/
else if (durum == 'G') {
motor1.run (FORWARD);
motor2.run (FORWARD);
motor3.run (FORWARD);
motor4.run (FORWARD);
servo.write(0);
}
/****************** Geri ****************************/
else if (durum == 'B') {
motor1.run (GERİ);
motor2.run (GERİ);
motor3.run (GERİ);
motor4.run (GERİ);
}
/******************* Geri Sağ **********************/
else if (durum == 'J') {
motor1.run (GERİ);
motor2.run (GERİ);
motor3.run (GERİ);
motor4.run (GERİ);
servo.write(90);
}
/******************* Geri Sol *********************/
else if (durum == 'H') {
motor1.run (GERİ);
motor2.run (GERİ);
motor3.run (GERİ);
motor4.run (GERİ);
servo.write(0);
}
/********************** Sağ *************************/
else if (durum == 'R') {
motor1.run (RELEASE);
motor2.run (RELEASE);
motor3.run (RELEASE);
motor4.run (RELEASE);
servo.write(90);
}
/*********************** Sol *************************/
else if (durum == 'L') {
motor1.run (RELEASE);
motor2.run (RELEASE);
motor3.run (RELEASE);
motor4.run (RELEASE);
servo.write(0);
}
/********************* Dur ************************/
else if (durum == 'S'){
motor1.run (RELEASE);
motor2.run (RELEASE);
motor3.run (RELEASE);
motor4.run (RELEASE);
}
}
ön tekerleri servo motorla kontrol edecegim arka tekerlerde normal tekerlekle iler geri yaptıracak
kod da hata v eriyor yardımcı olursanız sevinir
şimdiden teşekkürlerimi sunarım.
Telefon numaranı internette paylaşmanın mantıklı olucağını zannetmiyorum isteyenler burdan yazsınlar bence
Ayrıca hatayıda paylaşırmısın
Arduino:1.8.13 (Windows 10), Kart:"Arduino Uno"
BLUETOOTLU_ARABA:14:19: error: stray '\342' in program
BLUETOOTLU_ARABA:14:20: error: stray '\200' in program
BLUETOOTLU_ARABA:14:21: error: stray '\213' in program
BLUETOOTLU_ARABA:14:22: error: stray '\342' in program
BLUETOOTLU_ARABA:14:23: error: stray '\200' in program
BLUETOOTLU_ARABA:14:24: error: stray '\213' in program
BLUETOOTLU_ARABA:14:27: error: stray '\304' in program
BLUETOOTLU_ARABA:14:28: error: stray '\261' in program
BLUETOOTLU_ARABA:15:19: error: stray '\342' in program
BLUETOOTLU_ARABA:15:20: error: stray '\200' in program
BLUETOOTLU_ARABA:15:21: error: stray '\213' in program
BLUETOOTLU_ARABA:15:22: error: stray '\342' in program
BLUETOOTLU_ARABA:15:23: error: stray '\200' in program
BLUETOOTLU_ARABA:15:24: error: stray '\213' in program
BLUETOOTLU_ARABA:15:27: error: stray '\304' in program
BLUETOOTLU_ARABA:15:28: error: stray '\261' in program
BLUETOOTLU_ARABA:16:19: error: stray '\342' in program
BLUETOOTLU_ARABA:16:20: error: stray '\200' in program
BLUETOOTLU_ARABA:16:21: error: stray '\213' in program
BLUETOOTLU_ARABA:16:22: error: stray '\342' in program
BLUETOOTLU_ARABA:16:23: error: stray '\200' in program
BLUETOOTLU_ARABA:16:24: error: stray '\213' in program
BLUETOOTLU_ARABA:16:27: error: stray '\304' in program
BLUETOOTLU_ARABA:16:28: error: stray '\261' in program
BLUETOOTLU_ARABA:17:19: error: stray '\342' in program
BLUETOOTLU_ARABA:17:20: error: stray '\200' in program
BLUETOOTLU_ARABA:17:21: error: stray '\213' in program
BLUETOOTLU_ARABA:17:22: error: stray '\342' in program
BLUETOOTLU_ARABA:17:23: error: stray '\200' in program
BLUETOOTLU_ARABA:17:24: error: stray '\213' in program
BLUETOOTLU_ARABA:17:27: error: stray '\304' in program
BLUETOOTLU_ARABA:17:28: error: stray '\261' in program
BLUETOOTLU_ARABA:38:9: error: stray '\303' in program
BLUETOOTLU_ARABA:38:10: error: stray '\247' in program
BLUETOOTLU_ARABA:38:18: error: stray '\303' in program
BLUETOOTLU_ARABA:38:19: error: stray '\266' in program
BLUETOOTLU_ARABA:38:22: error: stray '\303' in program
BLUETOOTLU_ARABA:38:23: error: stray '\274' in program
BLUETOOTLU_ARABA:39:4: error: stray '\304' in program
BLUETOOTLU_ARABA:39:5: error: stray '\237' in program
BLUETOOTLU_ARABA:40:7: error: stray '\304' in program
BLUETOOTLU_ARABA:40:8: error: stray '\237' in program
BLUETOOTLU_ARABA:66:20: error: stray '\304' in program
BLUETOOTLU_ARABA:66:21: error: stray '\260' in program
BLUETOOTLU_ARABA:67:20: error: stray '\304' in program
BLUETOOTLU_ARABA:67:21: error: stray '\260' in program
BLUETOOTLU_ARABA:68:20: error: stray '\304' in program
BLUETOOTLU_ARABA:68:21: error: stray '\260' in program
BLUETOOTLU_ARABA:69:20: error: stray '\304' in program
BLUETOOTLU_ARABA:69:21: error: stray '\260' in program
BLUETOOTLU_ARABA:73:20: error: stray '\304' in program
BLUETOOTLU_ARABA:73:21: error: stray '\260' in program
BLUETOOTLU_ARABA:74:20: error: stray '\304' in program
BLUETOOTLU_ARABA:74:21: error: stray '\260' in program
BLUETOOTLU_ARABA:75:20: error: stray '\304' in program
BLUETOOTLU_ARABA:75:21: error: stray '\260' in program
BLUETOOTLU_ARABA:76:20: error: stray '\304' in program
BLUETOOTLU_ARABA:76:21: error: stray '\260' in program
BLUETOOTLU_ARABA:81:20: error: stray '\304' in program
BLUETOOTLU_ARABA:81:21: error: stray '\260' in program
BLUETOOTLU_ARABA:82:20: error: stray '\304' in program
BLUETOOTLU_ARABA:82:21: error: stray '\260' in program
BLUETOOTLU_ARABA:83:20: error: stray '\304' in program
BLUETOOTLU_ARABA:83:21: error: stray '\260' in program
BLUETOOTLU_ARABA:84:20: error: stray '\304' in program
BLUETOOTLU_ARABA:84:21: error: stray '\260' in program
C:\Users\aliad\OneDrive\Masaüstü\BLUETOOTLU_ARABA\BLUETOOTLU_ARABA.ino: In function 'void setup()':
BLUETOOTLU_ARABA:14:3: error: 'motor1' was not declared in this scope
C:\Users\aliad\OneDrive\Masaüstü\BLUETOOTLU_ARABA\BLUETOOTLU_ARABA.ino:14:3: note: suggested alternative: 'motoru1'
BLUETOOTLU_ARABA:14:26: error: 'H' was not declared in this scope
C:\Users\aliad\OneDrive\Masaüstü\BLUETOOTLU_ARABA\BLUETOOTLU_ARABA.ino:14:26: note: suggested alternative: 'ZH'
BLUETOOTLU_ARABA:15:3: error: 'motor2' was not declared in this scope
C:\Users\aliad\OneDrive\Masaüstü\BLUETOOTLU_ARABA\BLUETOOTLU_ARABA.ino:15:3: note: suggested alternative: 'motoru2'
BLUETOOTLU_ARABA:15:29: error: expected ')' before 'z'
BLUETOOTLU_ARABA:16:3: error: 'motor3' was not declared in this scope
C:\Users\aliad\OneDrive\Masaüstü\BLUETOOTLU_ARABA\BLUETOOTLU_ARABA.ino:16:3: note: suggested alternative: 'motoru3'
BLUETOOTLU_ARABA:16:29: error: expected ')' before 'z'
BLUETOOTLU_ARABA:17:3: error: 'motor4' was not declared in this scope
C:\Users\aliad\OneDrive\Masaüstü\BLUETOOTLU_ARABA\BLUETOOTLU_ARABA.ino:17:3: note: suggested alternative: 'motoru4'
BLUETOOTLU_ARABA:17:29: error: expected ')' before 'z'
C:\Users\aliad\OneDrive\Masaüstü\BLUETOOTLU_ARABA\BLUETOOTLU_ARABA.ino: In function 'void loop()':
BLUETOOTLU_ARABA:38:7: error: 'ge' was not declared in this scope
BLUETOOTLU_ARABA:110:1: error: expected '}' at end of input
exit status 1
stray '\342' in program
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Merhaba,
Kodda baya bir hata var onları düzeltiyorum şuan düzeltikten sonra buraya atıcam
1 Beğeni
Tüm hatalar tamam. Kodda hata vermesinin sebebi;
- Türkçe karakter kodda kullanmamanız gerekir(ı, ğ, ü, ö, ç, ş)
- Kodda GERİ yerine BACKWARD yazmanız lazım.
- İnternet sitelerinde koddları kopyalarken bazzen hata olabiliyor mümkünse kendiniz bakarak yazın hem klavye hızınızıda gelişir.
- noktalı virgüllere “;” ve süslü parantezleri"{ , }" doğru kullanmayı unutmayın.
Kolay gelsin
#include <Servo.h>
#include <AFMotor.h>
AF_DCMotor motor1 (1);
AF_DCMotor motor2 (2);
AF_DCMotor motor3 (3);
AF_DCMotor motor4 (4);
Servo servo;
int durum;
int Hiz=255;
void setup() {
motor1.setSpeed(Hiz);
motor2.setSpeed(Hiz);
motor3.setSpeed(Hiz);
motor4.setSpeed(Hiz);
servo.attach(7);
int aciDegeri=45;
Serial.begin(9600);
}
void loop() {
if(Serial.available() > 0){
durum = Serial.read();
servo.write(45);
}
// Uygulamadan ayarlanabilen 3 hız seviyesi.(Değerler 0-255 arası)
if (durum == '1'){
Hiz=50;}
else if (durum == '2'){
Hiz=150;}
else if (durum == '3'){
Hiz=255;
}
else{
durum=(Serial.available ()> 0);
}
durum = Serial.read ();
/******************** İleri *************************/
if (durum == 'F') {
motor1.run (FORWARD);
motor2.run (FORWARD);
motor3.run (FORWARD);
motor4.run (FORWARD);
}
/****************** İleri Sağ *********************/
else if (durum == 'I') {
motor1.run (FORWARD);
motor2.run (FORWARD);
motor3.run (FORWARD);
motor4.run (FORWARD);
servo.write(90);
}
/****************** İleri Sol ********************/
else if (durum == 'G') {
motor1.run (FORWARD);
motor2.run (FORWARD);
motor3.run (FORWARD);
motor4.run (FORWARD);
servo.write(0);
}
/****************** Geri ****************************/
else if (durum == 'B') {
motor1.run (BACKWARD);
motor2.run (BACKWARD);
motor3.run (BACKWARD);
motor4.run (BACKWARD);
}
/******************* Geri Sağ **********************/
else if (durum == 'J') {
motor1.run (BACKWARD);
motor2.run (BACKWARD);
motor3.run (BACKWARD);
motor4.run (BACKWARD);
servo.write(90);
}
/******************* Geri Sol *********************/
else if (durum == 'H') {
motor1.run (BACKWARD);
motor2.run (BACKWARD);
motor3.run (BACKWARD);
motor4.run (BACKWARD);
servo.write(0);
}
/********************** Sağ *************************/
else if (durum == 'R') {
motor1.run (RELEASE);
motor2.run (RELEASE);
motor3.run (RELEASE);
motor4.run (RELEASE);
servo.write(90);
}
/*********************** Sol *************************/
else if (durum == 'L') {
motor1.run (RELEASE);
motor2.run (RELEASE);
motor3.run (RELEASE);
motor4.run (RELEASE);
servo.write(0);
}
/********************* Dur ************************/
else if (durum == 'S'){
motor1.run (RELEASE);
motor2.run (RELEASE);
motor3.run (RELEASE);
motor4.run (RELEASE);
}
}
1 Beğeni
abi cok teşekkür ederim sen olmasaydın projeyi rafa kaldıracaktım <3
1 Beğeni