Error compiling

i am relativly new to c++ and ardunio so this is tricky for me

i wrote a sketch to control a motor with a IR controller but got this error code -

robot_test.ino:33:37: error: invalid suffix “DA0” on floating constant

i don’t know what it means and i would appreciate any information about a fix anyone has

thanks

My sketch:

#include <IRremote.h>

#include <AFMotor.h>

AF_DCMotor motor(4);

int RECV_PIN = 2;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}

void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
irrecv.resume(); // Receive the next value

if ((irrecv.decode(&results)) = 5E419DA0);
{
motor.run(FORWARD);
}
}
}

sigh, please use [ code] and [ / code]

0x5E419DA0
if( something() == constant)
{
}

sorry but i dont realy know what you mean by that pls talk me though it thanks

A hex constant is prefixed "0x", and a comparison operator is "==", not "="

Code tags make your code look like this//your code here

5E419DA0

The compiler sees this as a float constant 5x10419, with an unrecognized suffix “DA0”, hence the message.

Should read 0x5E419DA0, and the “=” should be “==”

i have made the alterations that you suggested and it now compilies :slight_smile:

but now when i run the code the controller still sends the receiver 5E419DA0 and this is printed in the serial monitor. this is what i wanted

but now i wish for the signal from the controller to run the motor which is what i have tried to do but it will not run the motor

any suggestions on how to change the code to do that because im a bit stuck now

thanks

#include <IRremote.h>

#include <AFMotor.h>

AF_DCMotor motor(4);


int RECV_PIN = 2;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
}

void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    irrecv.resume(); // Receive the next value
  }
    if (irrecv.decode(&results) == 0x5E419DA0);
    {
       motor.run(FORWARD);
     }
  
}
if (irrecv.decode(&results) == 0x5E419DA0);

Ever seen any of the examples of an “if” written like that?