Merhaba ben bir Otto robot yaptım ve ekstra olarak ır kumanda da ekledim fakat kodlama kısmına geçtiğimde (Otto blockly kullanarak) sürekli (tx+0×0) hatası alıyorum yardımcı olur musunuz? Arduino ide ile de denedim fakat aynı hata
#include <Otto.h>
Otto Otto;
#include <IRremote.h>
#include <PlayRtttl.hpp>
long Akif = 0;
IRrecv ir_rx(7);
decode_results ir_rx_results;
unsigned long fnc_ir_rx_decode()
{
bool decoded=false;
if( ir_rx.decode(&ir_rx_results))
{
decoded=true;
ir_rx.resume();
}
if(decoded)
return ir_rx_results.value;
else
return 0;
}
#include <EnableInterrupt.h>
#define Timeout 500
#define Shift 8
unsigned long time, dtime,timeout_mark;
unsigned long res = 0;
unsigned long Button_ID = 0;
unsigned int buf = 0;
byte impuls = 1;
byte Channl_ID = 1;
byte Button_en = 0;
byte state = 0;
byte Channl_buf = 0;
// Return if the key was pressed
bool RC(long BT_ID)
{
if (Timeout < millis() - timeout_mark)
Button_ID = 0x733;
if (BT_ID == Button_ID)
return 1;
return 0;
}
//Configuration Remote Control
void IRRC_setup(int pin, uint8_t Channl)
{
pinMode(pin, INPUT); //set the pin to input
digitalWrite(pin, HIGH); //use the internal pullup resistor
time = micros();
enableInterrupt(pin, change, CHANGE);
switch ( Channl )
{
case 1:
Channl_ID = 0xFC;
return;
case 2:
Channl_ID = 0x3C;
return;
case 3:
Channl_ID = 0xCC;
return;
case 4:
Channl_ID = 0x0C;
return;
case 5:
Channl_ID = 0xF0;
return;
case 6:
Channl_ID = 0x30;
return;
case 7:
Channl_ID = 0xC0;
return;
case 8:
Channl_ID = 0x00;
return;
//default:
}
}
//Interrupt function
void change()
{
dtime = micros();
buf = dtime - time ;
time = dtime;
//procesar la duración del pulso (200 redondeando hacia arriba con buf% 200> 101 y (o) si el pulso es <101 asignación de una sola longitud)
if (buf % 200 > 101)
{
buf = (buf / 200) + 1;
}
else
{
buf = buf / 200;
}
if (buf == 0) buf = 1;
if (state == 0) // Initial state
{
if (!impuls) //Checking the first bits (000)
{
state++;
res = 0;
res = res << buf;
//Serial.println(“Start”);
}
} else {
if (impuls)
{
res = res << buf;
for (int i = 0; i < buf ; i++)
{
res |= 1 << i ;
}
}else{
res = res << buf;
if ((byte)(res & 0x7F) == 0x38)
{
buf = 1;
for (int i = 1; i < Shift; i ++)
buf = (buf << 1) + 1;
Channl_buf = (res >> 6) & buf ;
if (Channl_buf == Channl_ID)
{
Button_ID = res >> (6+Shift);
while(!(Button_ID & 1)) Button_ID = Button_ID >> 1;
timeout_mark = millis();
//Serial.println (Button_ID, HEX);
}
state = 0;
res = 0;
}
}
}
impuls = !impuls;
}
#define LeftLeg 2 // left leg pin, servo[0]
#define RightLeg 3 // right leg pin, servo[1]
#define LeftFoot 4 // left foot pin, servo[2]
#define RightFoot 5 // right foot pin, servo[3]
#define Buzzer 13 //buzzer pin
void setup() {
Otto.init(LeftLeg, RightLeg, LeftFoot, RightFoot, true, Buzzer);
Otto.home();
ir_rx.enableIRIn();
IRRC_setup(7,7);
Akif = (unsigned long)fnc_ir_rx_decode();
}
void loop() {
if (Akif == (0x00FF629D)) {
Otto.walk(1,1000,1); // FORWARD
}
if (Akif == (0x00FFA857)) {
Otto.walk(1,1000,-1); // BACKWARD
}
if (Akif == (0x00FF22DD)) {
Otto.turn(1,1000,1); // LEFT
}
if (Akif == (0x00FF02FD)) {
Otto.home();
}
if (Akif == (0x00FFC23D)) {
Otto.turn(1,1000,-1); // RIGHT
}
if (Akif == (0x00FF6897)) {
Otto.crusaito(1, 1000, 25, 1);
}
if (Akif == (0x00FFB04F)) {
Otto.crusaito(1, 1000, 25, -1);
}
if (Akif == (0x00FF9867)) {
Otto.flapping(1, 1000, 25, 1);
}
if (Akif == (0x00FF18E7)) {
Otto.flapping(1, 1000, 25, -1);
}
if (Akif == (0x00FF38C7)) {
Otto.jitter(1, 1000, 25);
}
if (Akif == (0x00FF30CF)) {
Otto.swing(1, 1000, 25);
}
if (Akif == (0x00FF7A85)) {
Otto.tiptoeSwing(1, 1000, 25);
}
if (Akif == (0x00FF10EF)) {
Otto.updown(1, 1000, 25);
}
if (Akif == (0x00FF5AA5)) {
Otto.ascendingTurn(1, 1000, 25);
}
if (Akif == (0x00FF4AB5)) {
Otto.playGesture(OttoFail);
}
if (Akif == (0x00FF42BD) + (0x00FF6897)) {
playRtttlBlockingPGM(13,(char*)StarWars);
}
if (Akif == (0x00FF42BD) + (0x00FF9867)) {
playRtttlBlockingPGM(13,(char*)Simpsons);
}
if (Akif == (0x00FF42BD) + (0x00FFB04F)) {
playRtttlBlockingPGM(13,(char*)TakeOnMe);
}
if (Akif == (0x00FF42BD) + (0x00FF30CF)) {
playRtttlBlockingPGM(13,(char*)PinkPanther);
}
if (Akif == (0x00FF42BD) + (0x00FF18E7)) {
playRtttlBlockingPGM(13,(char*)_20thCenFox);
}
if (Akif == (0x00FF42BD) + (0x00FF7A85)) {
playRtttlBlockingPGM(13,(char*)JingleBell);
}
if (Akif == (0x00FF42BD) + (0x00FF10EF)) {
playRtttlBlockingPGM(13,(char*)Looney);
}
if (Akif == (0x00FF42BD) + (0x00FF38C7)) {
playRtttlBlockingPGM(13,(char*)Gadget);
}
if (Akif == (0x00FF42BD) + (0x00FF5AA5)) {
playRtttlBlockingPGM(13,(char*)Smurfs);
}
if (Akif == (0x00FF52AD) + (0x00FF6897)) {
Otto.playGesture(OttoSuperHappy);
}
if (Akif == (0x00FF52AD) + (0x00FF9867)) {
Otto.playGesture(OttoHappy);
}
if (Akif == (0x00FF52AD) + (0x00FFB04F)) {
Otto.playGesture(OttoSad);
}
if (Akif == (0x00FF52AD) + (0x00FF30CF)) {
Otto.playGesture(OttoSleeping);
}
if (Akif == (0x00FF52AD) + (0x00FF18E7)) {
Otto.playGesture(OttoConfused);
}
if (Akif == (0x00FF52AD) + (0x00FF7A85)) {
Otto.playGesture(OttoAngry);
}
if (Akif == (0x00FF52AD) + (0x00FF10EF)) {
Otto.playGesture(OttoMagic);
}
if (Akif == (0x00FF52AD) + (0x00FF38C7)) {
Otto.playGesture(OttoVictory);
}
if (Akif == (0x00FF52AD) + (0x00FF5AA5)) {
Otto.playGesture(OttoFail);
}
if (Akif == (0x00FF4AB5) + (0x00FF42BD)) {
Otto.moonwalker(1, 1000, 25, 1);
}
if (Akif == (0x00FF4AB5) + (0x00FF52AD)) {
Otto.moonwalker(1, 1000, 25, -1);
}
if (Akif == (0x00FF4AB5)) {
Otto.moonwalker(1, 1000, 25, 1);
Otto.moonwalker(1, 1000, 25, -1);
}
if (Akif == (0x00FF4AB5) + (0x00FF30CF)) {
Otto.shakeLeg(1,1000,-1);
}
if (Akif == (0x00FF4AB5) + (0x00FF7A85)) {
Otto.shakeLeg(1,1000,1);
}
}
kod bu
Arduino:1.8.19 (Windows Store 1.8.57.0) (Windows 10), Kart:“Arduino Nano, ATmega328P”
C:\Users\CASPER\Documents\Arduino\sketch_jul10b\sketch_jul10b.ino: In function ‘long unsigned int fnc_ir_rx_decode()’:
C:\Users\CASPER\Documents\Arduino\sketch_jul10b\sketch_jul10b.ino:15:34: warning: ‘bool IRrecv::decode(decode_results*)’ is deprecated: Please use IrReceiver.decode() without a parameter and IrReceiver.decodedIRData. . [-Wdeprecated-declarations]
if( ir_rx.decode(&ir_rx_results))
^
In file included from C:\Users\CASPER\Documents\Arduino\libraries\IRremote\src/IRremote.hpp:293:0,
from C:\Users\CASPER\Documents\Arduino\libraries\IRremote\src/IRremote.h:10,
from C:\Users\CASPER\Documents\Arduino\sketch_jul10b\sketch_jul10b.ino:3:
C:\Users\CASPER\Documents\Arduino\libraries\IRremote\src/IRReceive.hpp:1657:6: note: declared here
bool IRrecv::decode(decode_results *aResults) {
^~~~~~
libraries\SoftwareSerial\SoftwareSerial.cpp.o (symbol from plugin): In function `SoftwareSerial::read()':
(.text+0x0): multiple definition of `__vector_3’
sketch\sketch_jul10b.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\SoftwareSerial\SoftwareSerial.cpp.o (symbol from plugin): In function `SoftwareSerial::read()':
(.text+0x0): multiple definition of `__vector_4’
sketch\sketch_jul10b.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\SoftwareSerial\SoftwareSerial.cpp.o (symbol from plugin): In function `SoftwareSerial::read()':
(.text+0x0): multiple definition of `__vector_5’
sketch\sketch_jul10b.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
exit status 1
Arduino Nano kartı için derleme hatası.
This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.
hata bu