Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: LCD and Virtual wire on: April 19, 2013, 08:27:28 pm
That worked!

Thanks a ton!
2  Using Arduino / Programming Questions / Re: LCD and Virtual wire on: April 19, 2013, 07:48:11 pm
I've tried that before too. And in fact. It does print the whole word "End". However it also printed some "strange" characters that I can't get rid of it. Even if I use something like lcd.clear or lcd.print("              "); the characters remain there. That was the reason why I was also printing to the Serial. And when I looked at the serial output, some strange characters were also being printed.
3  Using Arduino / Programming Questions / Re: LCD and Virtual wire on: April 19, 2013, 07:31:46 pm
Because buf is of the type uint8_t * and when I use  lcd.print(but); I get an error saying that I can use this type as an argument for lcd.print.

4  Using Arduino / Programming Questions / Re: LCD and Virtual wire on: April 19, 2013, 07:04:42 pm
You are right. I messed up when I copied the code here. I removed the "Serial.write(msg);"  from my code and the lcd still only prints "E" out of the word "End".
The idea here:
        msg = *buf;
        lcd.print(msg);

is that msg will receive the contents of the pointer *buf. However since this is a string (more than one character)  the pointer only point to the first letter. How can I associate msg to the whole string and not only the first letter?

Thanks and sorry for the newbie question.
5  Using Arduino / Programming Questions / Re: LCD and Virtual wire on: April 19, 2013, 06:59:51 am
If I understood your reply correctly, you are talking about the Serial portion.

I am also using the serial to monitor the same data. It doesn't affect what I am trying to do with the LCD.

6  Using Arduino / Programming Questions / LCD and Virtual wire on: April 18, 2013, 11:03:17 pm
Hello,

This comes from a newbie.  I am using the Virtual wire library to transmit (through a 433 MHz transmitter) in a loop a character at time 0, 1... 9 and the string "End" at the end of the loop:



*************************

#include <VirtualWire.h>

void setup()
{
    Serial.begin(9600);
    Serial.println("setup");

    vw_set_tx_pin (12);
    vw_setup(1000);
}

void loop()
{
  char msg[27];


  for (int i=0; i <= 9; i++){
    sprintf(msg, "%i", i);
    digitalWrite(13, true);
    vw_send((uint8_t *)msg, strlen(msg));
    vw_wait_tx();
    Serial.println(i);
    digitalWrite(13, false);
    delay(1000);
    }
    sprintf(msg, "End");
    digitalWrite(13, true);
    vw_send((uint8_t *)msg, strlen(msg));
    vw_wait_tx();
    Serial.println(msg);
    digitalWrite(13, false);
    delay(1000);
}


**************************

Then, through another Arduino, I have a 433 MHz receiver end a 16x2 LCD attached. I am having success to display the number from 0 to 9 that I receive, but the string "End" only display the "E".

***************************
#include <VirtualWire.h>
#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);



void setup()
{
    lcd.begin(16, 2);
    Serial.begin(9600);   // Debugging only
    Serial.println("setup");
    lcd.print("setup");
    vw_set_rx_pin (7);
    vw_setup(1000);
    vw_rx_start();
}


void loop()
{
    uint8_t buf[VW_MAX_MESSAGE_LEN];
    uint8_t buflen = VW_MAX_MESSAGE_LEN;
    int i;
    char msg;

    if (vw_get_message(buf, &buflen))
    {
        lcd.clear();
        digitalWrite(13, true);

   Serial.print("Got: ");
   Serial.write(msg);
        Serial.println("");

        lcd.setCursor(0,0);
        lcd.print("Got:");
        lcd.setCursor(0, 1);
        msg = *buf;
        lcd.print(msg);


        digitalWrite(13, false);
    }
}

*******************************


I am having a hard time to understand the type uint8_t and its pointer and how I can convert buf into something that can be displayed with the function lcd.print. Can someone tell me what am I missing? How can I display on the LCD a longer (more than one character) string that comes from vw_get_message(buf, &buflen)?

Thanks a ton.


Pages: [1]