FS1000A Programing HELP

We are using FS1000A transmiters and an Arduino board. For some reason my code isn’t working. For some reason I think the buffer is being cleared or something so it can’t read. Please help me.
Here is the link for where we got the library and idea of the code.
http://zygzax.com/2013/03/15/comunicacion-entre-arduinos-por-medio-de-radiofrecuencia/?lang=en

this is the receive code.

#include <VirtualWire.h>

void setup()
{
Serial.begin(9600); // Configure the serial connection to the computer
vw_set_ptt_inverted(true); // Required by the RF module
vw_setup(2000); // bps connection speed
vw_set_rx_pin(3); // Arduino pin to connect the receiver data pin
vw_rx_start(); // Start the receiver
}

void loop()
{
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
if (vw_get_message(buf, &buflen)) // We check if we have received data
{
int i;
// Message with proper check
for (i = 0; i < buflen; i++)
{
Serial.write(buf*); // The received data is stored in the buffer*

  • // and sent through the serial port to the computer*
  • }*
  • Serial.println();*
  • if(Serial.read() == ‘H’)*
  • {*
  • Serial.flush();*
  • Serial.print(Serial.available());*
  • digitalWrite(13, HIGH);*
  • delay(500);*
  • digitalWrite(13, LOW);*
  • delay(500);*
  • }*
  • else*
  • {*
  • Serial.flush();*
  • digitalWrite(5, HIGH);*
  • delay(500);*
  • digitalWrite(5, LOW);*
  • delay(500);*
  • }*
  • }*
    }
    This is our transmitter code.
    #include <VirtualWire.h>
    void setup()
    {
  • vw_set_ptt_inverted(true); // Required by the RF module*
  • vw_setup(2000); // bps connection speed*
  • vw_set_tx_pin(3); // Arduino pin to connect the receiver data pin*
    }
    void loop()
    {
  • //Message to send:*
    _ char *go = “HELLO WORLD”;_
    vw_send((uint8_t *)go, strlen(go));
  • vw_wait_tx(); // We wait to finish sending the message*
  • delay(1000); // We wait to send the message again*
  • //Message to send:*
    _ char *st = “GOODBYE WORLD”;_
    vw_send((uint8_t *)st, strlen(st));
  • vw_wait_tx(); // We wait to finish sending the message*
  • delay(1000); // We wait to send the message again*
    }

For some reason my code isn’t working

Something to do with the use of italics?

USE CODE TAGS.

   Serial.flush();

Block until all pending output data has been sent. How is THAT useful?

I don't really know I want to get it to work the idea that I clear the buffer but for some reason I may think the the buffer that receives the code and the buffer the normal buffer is different

rochster:
I don't really know I want to get it to work the idea that I clear the buffer but for some reason I may think the the buffer that receives the code and the buffer the normal buffer is different

Again, please, but this time with punctuation?

There are two buffers - one containing data being received and one containing data being sent.

Receiving and sending serial data happens with interrupts, to minimize the impact on your program.

The Serial.print(), Serial.println(), and Serial.write() functions all write to the outgoing buffer, and return immediately, as long as there is room in the outgoing buffer. If not, they block, waiting for there to be room in the buffer.

The Serial.flush() function blocks, waiting for the outgoing buffer to be empty. It has NOTHING to do with the incoming buffer. I can't imagine why you are using the function at all.

If you don't know, stop using it. It isn't doing what you think it does, and makes you look foolish. You don't want that, do you?

PaulS:
There are two buffers - one containing data being received and one containing data being sent.

Is there a command that I can use so that I can read the buffer that is receiving Data?
If so, how is it used and if not any suggestions on what I should do?
Thanks so much for all of your help so far. :slight_smile:

Is there a command that I can use so that I can read the buffer that is receiving Data?

Serial.read()

AWOL:
Serial.read()

Thanks For trying, but for some reason it isn't working could u check the code.
thanks for all of your help. :slight_smile:

could u check the code.

Could you learn to spell?
Could you learn to use the shift key?
Could you post the damned code?

Sorry for being so annoying :frowning:
The code in at the top of the page I posted it at the being.
Thanks for all of your help. :slight_smile:

The code in at the top of the page I posted it

before I read the posting guidelines.