How to send a command via Transmitter/Tranceiver?

Hi everyone,

I am currently trying to make an RC Car, but first I have started simple by just trying to make a LED light up via a 433 MHz Transceiver and Transmitter. I am using the RadioHead library and I have been able to send character messages because of a tutorial I found, but I have been unable to convert that into a command that could turn an LED on. I have very limited coding skills and I can't find any tutorials for this.

Thanks for any help.

Our skills are none to help You with Your code.

Take a search engine of your choice and ask the WWW for ' RC Car +arduino ' to collect some data to be sorted out to get the needed information.

Let's say that you send the character 'n' to mean LED on (illuminated) and 'f' for LED off (dark). Your LED is wired from pin 4 to a resistor, then to the LED and the other leg of the LED goes to ground so it takes a HIGH to illuminate the LED.

The receiver could execute:

if( receivedChar == 'n')
{
     digitalWrite(LED_pin, HIGH);
}

I leave it to you to figure out how to turn the LED off.

Several example projects to be found by a Google search for;

'RC Car arduino 433mhz ask'

That's a very good first step. Please continue to take small steps and build progress. I do not count high enough the number of ppl who present a "complete" project that is no where near to working, and have no ]dea if any pieces would have functioned in simple sketches like you are trying.

Post the code that you've succeeded with. It is a trivial matter to repurpose arrived messages, or characters or whatever in order to accomplish something new or different.

You could use the IDE Autoformat tool first, then copy each sketch and use the <CODE/> tool in the message composition window here and

type or paste code here

Paste your code where it says. One for each sketch, sender and receiver.

a7

The first step, with any library, is to run a couple of the library examples, and verify that they work with your setup. Then, study them to learn how they work.

RadioHead comes with examples.

Here is my code for the transmitter (right now, it can only send a text)

#include <RH_ASK.h>
#include <SPI.h> // Not actually used but needed to compile

RH_ASK driver;

void setup()
{
    Serial.begin(9600);	  // Debugging only
    if (!driver.init())
         Serial.println("init failed");
}

void loop()
{
    const char * msg = "Hello World!";
    driver.send((uint8_t *)msg, strlen(msg));
    driver.waitPacketSent();
    delay(1000);
}

Here is my transceiver:

#include <RH_ASK.h>
#include <SPI.h> // Not actualy used but needed to compile

RH_ASK driver;


void setup()
{
    Serial.begin(9600);	// Debugging only
    if (!driver.init())
         Serial.println("init failed");
}

void loop()
{
    uint8_t buf[12];
    uint8_t buflen = sizeof(buf);
    if (driver.recv(buf, &buflen)) // Non-blocking
    {
      // Message with a good checksum received, dump it.
      Serial.print("Message: ");
      Serial.println((char*)buf);
    }
}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.